Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pdevty/polymer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'static/bower_components/iron-meta/test')
-rw-r--r--static/bower_components/iron-meta/test/basic.html48
-rw-r--r--static/bower_components/iron-meta/test/index.html30
-rw-r--r--static/bower_components/iron-meta/test/iron-meta.html186
3 files changed, 264 insertions, 0 deletions
diff --git a/static/bower_components/iron-meta/test/basic.html b/static/bower_components/iron-meta/test/basic.html
new file mode 100644
index 0000000..c561dc3
--- /dev/null
+++ b/static/bower_components/iron-meta/test/basic.html
@@ -0,0 +1,48 @@
+<!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>iron-meta-basic</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+
+ <link rel="import" href="../iron-meta.html">
+
+</head>
+<body>
+
+ <iron-meta key="info" value="foo/bar"></iron-meta>
+
+ <script>
+
+ suite('basic', function() {
+
+ test('byKey', function() {
+ var meta = document.createElement('iron-meta');
+ assert.equal(meta.byKey('info'), 'foo/bar');
+ });
+
+ test('list', function() {
+ var meta = document.createElement('iron-meta');
+ assert.equal(meta.list.length, 1);
+ });
+
+ });
+
+ </script>
+
+</body>
+</html>
diff --git a/static/bower_components/iron-meta/test/index.html b/static/bower_components/iron-meta/test/index.html
new file mode 100644
index 0000000..2b9541b
--- /dev/null
+++ b/static/bower_components/iron-meta/test/index.html
@@ -0,0 +1,30 @@
+<!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>
+
+ <meta charset="utf-8">
+ <title>Tests</title>
+ <script src="../../web-component-tester/browser.js"></script>
+
+</head>
+<body>
+
+ <script>
+ WCT.loadSuites([
+ 'basic.html',
+ 'iron-meta.html'
+ ]);
+ </script>
+
+</body>
+</html>
diff --git a/static/bower_components/iron-meta/test/iron-meta.html b/static/bower_components/iron-meta/test/iron-meta.html
new file mode 100644
index 0000000..c1a4028
--- /dev/null
+++ b/static/bower_components/iron-meta/test/iron-meta.html
@@ -0,0 +1,186 @@
+<!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>iron-meta</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+ <script src="../../test-fixture/test-fixture-mocha.js"></script>
+
+ <link rel="import" href="../iron-meta.html">
+ <link rel="import" href="../../test-fixture/test-fixture.html">
+
+ </head>
+ <body>
+
+ <test-fixture id="TrivialMeta">
+ <template>
+ <iron-meta self key="info"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="ManyMetas">
+ <template>
+ <iron-meta self key="default1"></iron-meta>
+ <iron-meta self key="default2"></iron-meta>
+ <iron-meta self key="default3"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="DifferentTypedMetas">
+ <template>
+ <iron-meta self type="foo" key="foobarKey"></iron-meta>
+ <iron-meta self type="bar" key="foobarKey"></iron-meta>
+ <iron-meta self key="defaultKey"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="ClashingMetas">
+ <template>
+ <iron-meta self key="baz"></iron-meta>
+ <iron-meta self key="baz"></iron-meta>
+ </template>
+ </test-fixture>
+
+ <script>
+suite('<iron-meta>', function () {
+ suite('basic behavior', function () {
+ var meta;
+
+ setup(function () {
+ meta = fixture('TrivialMeta');
+ });
+
+ teardown(function () {
+ meta.key = null;
+ });
+
+ test('uses itself as the default value', function () {
+ expect(meta.value).to.be.equal(meta);
+ });
+
+ test('can be assigned alternative values', function () {
+ meta.value = 'foobar';
+
+ expect(meta.list[0]).to.be.equal('foobar');
+ });
+
+ test('can access same-type meta values by key', function () {
+ expect(meta.byKey(meta.key)).to.be.equal(meta.value);
+ });
+
+ test('yields a list of same-type meta data', function () {
+ expect(meta.list).to.be.ok;
+ expect(meta.list.length).to.be.equal(1);
+ expect(meta.list[0]).to.be.equal(meta);
+ });
+ });
+
+ suite('many same-typed metas', function () {
+ var metas;
+
+ setup(function () {
+ metas = fixture('ManyMetas');
+ });
+
+ teardown(function () {
+ metas.forEach(function (meta) {
+ meta.key = null;
+ });
+ });
+
+ test('all cache all meta values', function () {
+ metas.forEach(function (meta, index) {
+ expect(meta.list.length).to.be.equal(metas.length);
+ expect(meta.list[index].value).to.be.equal(meta.value);
+ });
+ });
+
+ test('can be unregistered individually', function () {
+ metas[0].key = null;
+
+ expect(metas[0].list.length).to.be.equal(2);
+ expect(metas[0].list).to.be.deep.equal([metas[1], metas[2]])
+ });
+
+ test('can access each others value by key', function () {
+ expect(metas[0].byKey('default2')).to.be.equal(metas[1].value);
+ });
+ });
+
+ suite('different-typed metas', function () {
+ var metas;
+
+ setup(function () {
+ metas = fixture('DifferentTypedMetas');
+ });
+
+ teardown(function () {
+ metas.forEach(function (meta) {
+ meta.key = null;
+ });
+ });
+
+ test('cache their values separately', function () {
+ var fooMeta = metas[0];
+ var barMeta = metas[1];
+
+ expect(fooMeta.value).to.not.be.equal(barMeta.value);
+ expect(fooMeta.byKey('foobarKey')).to.be.equal(fooMeta.value);
+ expect(barMeta.byKey('foobarKey')).to.be.equal(barMeta.value);
+ });
+
+ test('cannot access values of other types', function () {
+ var defaultMeta = metas[2];
+
+ expect(defaultMeta.byKey('foobarKey')).to.be.equal(undefined);
+ });
+
+ test('only list values of their type', function () {
+ metas.forEach(function (meta) {
+ expect(meta.list.length).to.be.equal(1);
+ expect(meta.list[0]).to.be.equal(meta.value);
+ })
+ });
+ });
+
+ suite('metas with clashing keys', function () {
+ var metaPair;
+
+ setup(function () {
+ metaPair = fixture('ClashingMetas');
+ });
+
+ teardown(function () {
+ metaPair.forEach(function (meta) {
+ meta.key = null;
+ });
+ });
+
+ test('let the last value win registration against the key', function () {
+ var registeredValue = metaPair[0].byKey(metaPair[0].key);
+ var firstValue = metaPair[0].value;
+ var secondValue = metaPair[1].value;
+
+ expect(registeredValue).to.not.be.equal(firstValue);
+ expect(registeredValue).to.be.equal(secondValue);
+ });
+ });
+});
+ </script>
+
+ </body>
+</html>