mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-05-10 15:56:07 +00:00
58 lines
2.2 KiB
HTML
58 lines
2.2 KiB
HTML
<!doctype html>
|
|
<!--
|
|
@license
|
|
Copyright (c) 2014 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 lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>HTMLImports Path Tests</title>
|
|
<script src="../../../src/HTMLImports/HTMLImports.js"></script>
|
|
<script src="../../../bower_components/web-component-tester/browser.js"></script>
|
|
<link rel="import" href="imports/style-paths-import.html">
|
|
</head>
|
|
<body>
|
|
<div class="red">red</div>
|
|
<div class="image" style="height: 20px;"></div>
|
|
<div style="font-family: 'Source Code Pro'">Source Code Pro</div>
|
|
<script>
|
|
|
|
test('style-paths', function(done) {
|
|
// NOTE: IE requires asynchrony here
|
|
setTimeout(function() {
|
|
var i = document.querySelector('[rel=import]');
|
|
var doc = i.import;
|
|
|
|
var red = document.querySelector('.red');
|
|
chai.assert.equal(getComputedStyle(red).backgroundColor, 'rgb(255, 0, 0)', 'style in @import applied');
|
|
var image = document.querySelector('.image');
|
|
|
|
// document relative image url
|
|
var a = document.createElement('a');
|
|
a.href = 'imports/google.png';
|
|
chai.assert.match(getComputedStyle(image).backgroundImage, new RegExp(a.href), 'url in style applied');
|
|
|
|
if (!HTMLImports.useNative) {
|
|
var styles = document.querySelectorAll('style');
|
|
var fontStyle = [].filter.call(styles, function(s) {
|
|
return s.textContent.indexOf('Source+Code+Pro') > -1;
|
|
})[0];
|
|
assert.ok(fontStyle);
|
|
chai.assert.ok(fontStyle.sheet);
|
|
chai.assert.equal(fontStyle.sheet.cssRules[2].href,
|
|
'http://fonts.googleapis.com/css?family=Open+Sans:300,300italic,600,800|Source+Code+Pro',
|
|
'@import url() form rule has proper url')
|
|
}
|
|
|
|
done();
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|