import { expect } from 'chai' import { polyfill } from '../mod.js' describe('Custom Elements', () => { const target = {} beforeEach(() => polyfill(target)) it('Includes Custom Element functionality', () => { expect(target).to.have.property('CustomElementRegistry') expect(target).to.have.property('customElements') expect(target).to.have.property('HTMLElement') }) it('Supports Custom Element creation', () => { const CustomElement = class HTMLCustomElement extends target.HTMLElement {} target.customElements.define('custom-element', CustomElement) expect(target.customElements.get('custom-element')).to.equal(CustomElement) expect(target.customElements.getName(CustomElement)).to.equal( 'custom-element' ) }) it('Supports Custom Elements created from Document', () => { expect(target.document.body.localName).to.equal('body') expect(target.document.body.tagName).to.equal('BODY') expect( target.document.createElement('custom-element').constructor.name ).to.equal('HTMLUnknownElement') const CustomElement = class HTMLCustomElement extends target.HTMLElement {} target.customElements.define('custom-element', CustomElement) expect( target.document.createElement('custom-element').constructor.name ).to.equal('HTMLCustomElement') }) it('Supports Custom Elements with properties', () => { const testSymbol = Symbol.for('webapi.test') const CustomElement = class HTMLCustomElement extends target.HTMLElement { otherMethod = () => testSymbol method() { return this.otherMethod() } static method() { return this.otherMethod() } static otherMethod() { return testSymbol } } target.customElements.define('custom-element', CustomElement) expect(CustomElement.method()).to.equal(testSymbol) const customElement = new CustomElement() expect(customElement.method()).to.equal(testSymbol) }) }) value='memory_lane_experiment'>memory_lane_experiment Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/LICENSE-APACHE (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2018-01-11adapt to changes in the cortex-m crateGravatar Jorge Aparicio 11-42/+69
2018-01-11fix the compiletest_rs versionGravatar Jorge Aparicio 1-1/+1
2018-01-11switch to a stable release of compiletest_rsGravatar Jorge Aparicio 1-2/+1
2018-01-11use master branch of cortex-mGravatar Jorge Aparicio 1-1/+1
2017-12-23add a Cargo feature, cm7-r0p1, to fix a Cortex-M7 BASEPRI erratumGravatar Jorge Aparicio 3-2/+17
2017-12-23switch to a compiletest version that works with the latest nightlyGravatar Jorge Aparicio 1-1/+2
2017-12-23switch to master branchesGravatar Jorge Aparicio 2-3/+3
2017-12-17add missing commaGravatar Jorge Aparicio 1-1/+1
2017-12-09safe `&'static mut` references via init.resourcesGravatar Jorge Aparicio 6-10/+153
2017-12-09implement the Resource trait for owned resourcesGravatar Jorge Aparicio 11-220/+278
2017-12-09drop the Static wrapperGravatar Jorge Aparicio 8-26/+28
2017-12-09make resource proxies not SyncGravatar Jorge Aparicio 2-3/+2
2017-12-09also cache the Xargo directoryGravatar Jorge Aparicio 1-1/+4
2017-12-09deny warnings and unsafe code in tests and examplesGravatar Jorge Aparicio 24-0/+24
2017-12-09make resource proxies !SendGravatar Jorge Aparicio 2-2/+58
2017-12-09fix the "generics" exampleGravatar Jorge Aparicio 1-2/+2
2017-12-09rename LateResourceValues to LateResourcesGravatar Jorge Aparicio 4-9/+9
2017-12-09remove special case around peripherals from codegenGravatar Jorge Aparicio 1-209/+114
2017-12-09peripherals as scoped singletonsGravatar Jorge Aparicio 7-30/+68
2017-12-08ci: switch back to a recent nightlyGravatar Jorge Aparicio 1-2/+1
2017-12-08fix cfail testsGravatar Jorge Aparicio 2-2/+2
2017-11-22use older nightly for the x86_64 linux targetGravatar Jorge Aparicio 1-1/+2
2017-11-22fix ciGravatar Jorge Aparicio 3-4/+2
2017-11-22v0.2.2v0.2.2Gravatar Jorge Aparicio 10-61/+161
2017-10-02fix the exampleGravatar Jorge Aparicio 1-2/+2
2017-10-02fix `idle::Resources::new`Gravatar Jorge Aparicio 2-2/+13
2017-09-22Use `true` as the armv6 linkerGravatar Jonas Schievink 1-2/+2
2017-09-22Pin Travis to Xargo 0.3.8Gravatar Jonas Schievink 1-2/+2
2017-09-22Use rtfm-syntax 0.2.0Gravatar Jonas Schievink 1-2/+1