-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update browser list for custom elements (#179)
* update browser list for custom elements * better
- Loading branch information
1 parent
a2a3983
commit b9df7d5
Showing
5 changed files
with
40 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/core-web-tests/src/test_customElements.define.extends.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
QUnit.skip('customElements.define with extends', function (assert) { | ||
class TestElementExtender extends HTMLButtonElement { | ||
foo() { | ||
return 'baz'; | ||
} | ||
} | ||
|
||
customElements.define('test-element-extender', TestElementExtender, { extends: 'button' }); | ||
const fixture = document.getElementById('qunit-fixture'); | ||
|
||
fixture.innerHTML = '<button is="test-element-extender"></button>'; | ||
|
||
const el = fixture.querySelector('button'); | ||
assert.equal(el.foo(), 'baz'); | ||
}); |
28 changes: 14 additions & 14 deletions
28
packages/core-web-tests/src/test_customElements.define.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
QUnit.test("customElements.define", function(assert) { | ||
QUnit.test('customElements.define', function(assert) { | ||
class TestElementA extends HTMLElement { | ||
foo() { | ||
return "baz"; | ||
return 'baz'; | ||
} | ||
} | ||
|
||
customElements.define("test-element-a", TestElementA); | ||
const fixture = document.getElementById("qunit-fixture"); | ||
customElements.define('test-element-a', TestElementA); | ||
const fixture = document.getElementById('qunit-fixture'); | ||
|
||
fixture.innerHTML = "<test-element-a></test-element-a>"; | ||
fixture.innerHTML = '<test-element-a></test-element-a>'; | ||
|
||
const el = fixture.querySelector("test-element-a"); | ||
assert.equal(el.foo(), "baz"); | ||
const el = fixture.querySelector('test-element-a'); | ||
assert.equal(el.foo(), 'baz'); | ||
}); | ||
|
||
QUnit.test("customElements.connectedCallback", function(assert) { | ||
QUnit.test('customElements.connectedCallback', function(assert) { | ||
class TestElementB extends HTMLElement { | ||
constructor() { | ||
super(); | ||
|
||
this._content = "rendered content"; | ||
this._content = 'rendered content'; | ||
} | ||
|
||
connectedCallback() { | ||
this.innerHTML = this._content || ""; | ||
this.innerHTML = this._content || ''; | ||
} | ||
} | ||
|
||
customElements.define("test-element-b", TestElementB); | ||
const fixture = document.getElementById("qunit-fixture"); | ||
customElements.define('test-element-b', TestElementB); | ||
const fixture = document.getElementById('qunit-fixture'); | ||
const elStart = new TestElementB(); | ||
|
||
fixture.appendChild(elStart); | ||
|
||
const elOut = fixture.querySelector("test-element-b"); | ||
assert.equal(elOut.innerHTML, "rendered content"); | ||
const elOut = fixture.querySelector('test-element-b'); | ||
assert.equal(elOut.innerHTML, 'rendered content'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters