Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
add test for duplicate names
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Nov 25, 2013
1 parent 9778e04 commit f374cb2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/js/customElements.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
assert.ok(false, 'document.register failed to throw when given no arguments');
});

test('document.register requires name argument to be unique', function() {
var proto = {prototype: Object.create(HTMLElement.prototype)};
document.register('x-duplicate', proto);
try {
document.register('x-duplicate', proto);
} catch(x) {
return;
}
assert.ok(false, 'document.register failed to throw when called multiple times with the same element name');
});

test('document.register create via new', function() {
// register x-foo
var XFoo = document.register('x-foo', {prototype: Object.create(HTMLElement.prototype)});
Expand Down

0 comments on commit f374cb2

Please sign in to comment.