1<!doctype html>
2<!--
3@license
4Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
5This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8Code distributed by Google as part of the polymer project is also
9subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10-->
11<script src="./test-flags.js"></script>
12<script src="../node_modules/wct-browser-legacy/browser.js"></script>
13<script src="../node_modules/@webcomponents/webcomponents-platform/webcomponents-platform.js"></script>
14<script src="../node_modules/es6-promise/dist/es6-promise.auto.min.js"></script>
15<script src="../node_modules/@webcomponents/shadydom/shadydom.min.js"></script>
16<script>
17  suite('Settings', () => {
18    window.ShadyCSS = { cssBuild: 'shady' }
19    let origCss;
20    let origShady;
21    let origCssBuild;
22    test(`settings remain correct no matter the order of components loaded ${JSON.stringify(window.WebComponents.flags)}`, (done) => {
23      let script = document.createElement('script');
24      script.src = '../custom-style-interface.min.js';
25      script.onerror = (err) => done(err);
26      script.onload = () => {
27        origCss = window.ShadyCSS.nativeCss;
28        origShady = window.ShadyCSS.nativeShadow;
29        origCssBuild = window.ShadyCSS.cssBuild;
30        assert.notEqual(origCss, undefined, 'nativeCss should be defined');
31        assert.notEqual(origShady, undefined, 'nativeShadow should be defined');
32        assert.equal(origCssBuild, 'shady', 'cssBuild should be defined');
33        let script = document.createElement('script');
34        script.src = '../apply-shim.min.js';
35        script.onerror = (err) => done(err);
36        script.onload = () => {
37          assert.equal(origCss, window.ShadyCSS.nativeCss);
38          assert.equal(origShady, window.ShadyCSS.nativeShadow);
39          assert.equal(origCssBuild, window.ShadyCSS.cssBuild);
40          let script = document.createElement('script');
41          script.src = '../scoping-shim.min.js';
42          script.onerrer = (err) => done(err);
43          script.onload = () => {
44            assert.equal(origCss, window.ShadyCSS.nativeCss);
45            assert.equal(origShady, window.ShadyCSS.nativeShadow);
46            assert.equal(origCssBuild, window.ShadyCSS.cssBuild);
47            done();
48          };
49          document.head.appendChild(script);
50        }
51        document.head.appendChild(script);
52      }
53      document.head.appendChild(script);
54    });
55    test('Native CSS Custom Properties disabled if ShadyDOM is in use', () => {
56      if (!window.ShadyDOM || !window.ShadyDOM.inUse) {
57        assert.isTrue(window.ShadyCSS.nativeCss, 'nativeCss should be enabled if not using ShadyDOM');
58      }
59    })
60  });
61</script>