Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #84. Removes the stringified regex from the warning message #85

Merged
merged 1 commit into from
Jun 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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