update components

This commit is contained in:
Luke Pulverenti 2016-03-04 22:39:49 -05:00
parent 7dbb1f7535
commit b447272b19
26 changed files with 478 additions and 107 deletions

View file

@ -1,5 +1,4 @@
<!doctype html>
<!--
<!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
@ -7,10 +6,7 @@ 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>
--><html><head>
<meta charset="utf-8">
<title>Tests</title>
@ -20,12 +16,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script>
WCT.loadSuites([
'iron-icon.html'
'iron-icon.html',
'iron-icon.html?dom=shadow'
]);
</script>
</body>
</html>
</body></html>

View file

@ -24,6 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../iron-iconset/iron-iconset.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="icon-holder.html">
</head>
<body>
@ -61,6 +62,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="SrcIconSwitch">
<template>
<iron-iconset name="example" icons="location blank" src="location.png" size="24" width="48"></iron-iconset>
<iron-icon></iron-icon>
</template>
</test-fixture>
<test-fixture id="ParentForceUpdate">
<template>
<icon-holder>
<iron-icon></iron-icon>
</icon-holder>
</template>
</test-fixture>
<script>
function iconElementFor (node) {
var nodes = Polymer.dom(node.root).childNodes;
@ -143,6 +159,60 @@ suite('<iron-icon>', function() {
});
});
});
suite('when switching between src and icon properties', function() {
var icon;
setup(function() {
var elements = fixture('IconFromIconset');
icon = elements[1];
});
test('will display the icon if both icon and src are set', function() {
icon.src = '../demo/location.png';
icon.icon = 'example:location';
expect(hasIcon(icon)).to.be.true;
expect(iconElementFor(icon)).to.not.exist;
// Check if it works too it we change the affectation order
icon.icon = 'example:location';
icon.src = '../demo/location.png';
expect(hasIcon(icon)).to.be.true;
expect(iconElementFor(icon)).to.not.exist;
});
test('will display the icon when src is defined first and then reset', function() {
icon.src = '../demo/location.png';
icon.icon = null;
icon.src = null;
icon.icon = 'example:location';
expect(hasIcon(icon)).to.be.true;
expect(iconElementFor(icon)).to.not.exist;
});
test('will display the src when icon is defined first and then reset', function() {
icon.src = null;
icon.icon = 'example:location';
icon.src = '../demo/location.png';
icon.icon = null;
expect(hasIcon(icon)).to.be.false;
expect(iconElementFor(icon)).to.exist;
});
test('will display nothing if both properties are unset', function() {
icon.src = '../demo/location.png';
icon.icon = 'example:location';
icon.src = null;
icon.icon = null;
expect(hasIcon(icon)).to.be.false;
expect(iconElementFor(icon)).to.not.exist;
});
});
suite('ancestor direct updates', function() {
test('handle properties set before ready', function() {
var holder = fixture('ParentForceUpdate');
});
});
});
</script>