Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/spec/custom-elements-registry/get.html

Issue 1994093002: Introduce CustomElementRegistry#get() method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-01T15:09:57 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <!--
3 TODO(yosin): We should upstream to wpt test.
4 This file is taken from https://github.com/kojiishi/web-platform-tests/blob/5390 8d773012edf931047674f7afe3975bc1820f/custom-elements/custom-elements-registry/ge t.html
5 -->
6 <title>Custom Elements: CustomElementsRegistry.get</title>
7 <script src="../../../resources/testharness.js"></script>
8 <script src="../../../resources/testharnessreport.js"></script>
9 <body>
10 <div id="log"></div>
11 <script>
12 'use strict';
13 (() => {
14 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsreg istry-whendefined
15 // Use window from iframe to isolate the test.
16 function setup() {
17 const iframe = document.createElement('iframe');
18 document.body.appendChild(iframe);
19 const testWindow = iframe.contentWindow;
20 const customElements = testWindow.customElements;
21 if (!customElements)
22 return Promise.reject('This test requires window.customElements');
23 if (!('get' in customElements))
24 return Promise.reject('This test requires window.customElements.get');
25 return Promise.resolve(customElements);
26 }
27
28 promise_test(() => setup()
29 .then(customElements => {
30 // 1. If this CustomElementsRegistry contains an entry with name name,
31 // then return that entry's constructor.
32 const name = 'test-get-existing';
33 class C extends HTMLElement {};
34 customElements.define(name, C);
35 assert_equals(customElements.get(name), C, 'get() returns the constructor' )
36 return Promise.resolve(customElements);
37 }).then(customElements => {
38 // 2. Otherwise, return undefined.
39 assert_equals(customElements.get('test-get-not-defined'), undefined,
40 'get() returns undefined for not-defined name');
41 }).catch(reason => { throw reason }));
42 })();
43 </script>
44 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698