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

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-05-23T13:42:56 Created 4 years, 7 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 <iframe id="iframe"></iframe>
dominicc (has gone to gerrit) 2016/05/25 01:31:23 I think it is better to dynamically create these;
yosin_UTC9 2016/05/30 06:17:55 Done
12 <script>
13 'use strict';
14 (() => {
15 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsreg istry-whendefined
16 // Use window from iframe to isolate the test.
17 const testWindow = iframe.contentDocument.defaultView;
dominicc (has gone to gerrit) 2016/05/25 01:31:23 iframe.contentWindow
yosin_UTC9 2016/05/30 06:17:55 Done
18 const customElements = testWindow.customElements;
19 let testable = false;
dominicc (has gone to gerrit) 2016/05/25 01:31:23 I wonder what it would look like if testable was a
yosin_UTC9 2016/05/30 06:17:55 Done
20 test(() => {
21 assert_true('customElements' in testWindow, '"window.customElements" exists' );
22 assert_true('get' in customElements, '"window.customElements.get" exists');
23 testable = true;
24 }, '"window.customElements.get" should exist');
25 if (!testable)
26 return;
27 // 1. If this CustomElementsRegistry contains an entry with name name,
28 // then return that entry's constructor.
29 test(() => {
30 const name = 'test-get-existing';
31 class C extends HTMLElement {};
32 customElements.define(name, C);
33 assert_equals(customElements.get(name), C);
34 }, 'get() returns the constructor');
35 // 2. Otherwise, return undefined.
36 test(() => {
37 assert_equals(customElements.get('test-get-not-defined'), undefined);
38 }, 'get() returns undefined if the name is not defined');
39 })();
40 </script>
41 </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