UNPKG

img-2

Version:

Replace <img /> elements with <img-2> to automatically pre-cache images and improve page performance.

59 lines (51 loc) 2.05 kB
<!doctype html> <!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <html> <head> <title>Template with HTMLImports Test</title> <script src="../webcomponents-loader.js"></script> <script src="../../web-component-tester/browser.js"></script> </head> <body> <template id="one"> <link rel="import" href="imports/script-1.html"> </template> <template id="two"> <link rel="import" href="imports/csp-import-1.html"> </template> <script> suite('basic', function() { var templateOne; var templateTwo; setup(function() { templateOne = document.querySelector('template#one'); templateTwo = document.querySelector('template#two'); }); teardown(function() { window.remoteCurrentScriptExecuted = undefined; window.externalScriptParsed1 = undefined; }); test('links are not imported before stamping', function() { assert.equal(window.remoteCurrentScriptExecuted, undefined); assert.equal(window.externalScriptParsed1, undefined); }); test('links are imported when stamped', function(done) { document.head.appendChild(document.importNode(templateTwo.content, true)); var imp = document.querySelector('[href="imports/csp-import-1.html"]'); imp.addEventListener('load', function() { assert.ok(window.externalScriptParsed1); done(); }); }); }); </script> </body> </html>