From f374cb2fdb07544afe1e3250a6eb8a2311aed77d Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 25 Nov 2013 12:54:39 -0800 Subject: [PATCH] add test for duplicate names --- test/js/customElements.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/js/customElements.js b/test/js/customElements.js index 45ca890..d3cc3cf 100644 --- a/test/js/customElements.js +++ b/test/js/customElements.js @@ -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)});