Skip to content

Commit

Permalink
Merge pull request #85 from canjs/84-not-regex-in-warning
Browse files Browse the repository at this point in the history
Fixes #84. Removes the stringified regex from the warning message
  • Loading branch information
justinbmeyer authored Jun 2, 2018
2 parents ea74c7d + aa36cd4 commit e08b24a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion can-view-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var attr = function (attributeName, attrHandler) {
//!steal-remove-start
Object.keys(requestedAttributes).forEach(function(requested){
if(attributeName.test(requested)) {
dev.warn("can-view-callbacks: " + requested+ " custom attribute behavior requested before it was defined. Make sure "+attributeName+" is defined before it is needed.");
dev.warn("can-view-callbacks: " + requested+ " custom attribute behavior requested before it was defined. Make sure "+requested+" is defined before it is needed.");
}
});
//!steal-remove-end
Expand Down
6 changes: 3 additions & 3 deletions test/callbacks-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ testHelpers.devOnlyTest("should warn if attr callback defined after attr request
equal(teardown(), 1, "got warning");
});

testHelpers.devOnlyTest("should warn if RegExp attr callback defined after attr requested (#57)", function () {
testHelpers.devOnlyTest("should warn if RegExp attr callback defined after attr requested (#57, #84)", function () {
var attrName = "masonry-wall";
var attrMatch = /masonry[- ]?wall/;
var teardown = testHelpers.willWarn("can-view-callbacks: " + attrName+ " custom attribute behavior requested before it was defined. Make sure "+attrMatch.toString()+" is defined before it is needed.");
var teardown = testHelpers.willWarn("can-view-callbacks: " + attrName+ " custom attribute behavior requested before it was defined. Make sure "+attrName+" is defined before it is needed.");

// calback attr requested
callbacks.attr(attrName);

// callback attr provided
callbacks.attr(attrMatch, function(){});
callbacks.attr(attrMatch, function() {});

equal(teardown(), 1, "got warning");
});
Expand Down

0 comments on commit e08b24a

Please sign in to comment.