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

Closes #65 Exception in mixin core when checking valid attribute of undefined attribute. #66

Merged
merged 2 commits into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/common/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,10 @@ define([
ensureType(name, 'name', 'string');
ensureValue(value, 'value');

if ((core.getValidAttributeNames(node) || []).indexOf(name) === -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't core.getValidAttributeNames(node) always return an array?

throw new CoreIllegalOperationError('Not a valid attribute name [' + name + '] of the node.');
}

return core.isValidAttributeValueOf(node, name, value);
};

Expand Down
11 changes: 10 additions & 1 deletion test/common/core/core.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2889,7 +2889,16 @@ describe('core', function () {
}

try {
core.isValidAttributeValueOf(rootNode, 'attr', undefined);
core.isValidAttributeValueOf(rootNode, 'name', undefined);
} catch (e) {
myError = e;
} finally {
expect(myError.name).to.eql('CoreIllegalArgumentError');
myError = null;
}

try {
core.isValidAttributeValueOf(rootNode, 'nonexisting', undefined);
} catch (e) {
myError = e;
} finally {
Expand Down