Skip to content

Commit

Permalink
Merge pull request #19 from cheonhyangzhang/feat/13
Browse files Browse the repository at this point in the history
 [feat/13] Multiple element is sharing the variable if no initial var…
  • Loading branch information
cheonhyangzhang authored Sep 14, 2016
2 parents 41eb51c + 939b07f commit 4dfc97a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion paper-tags-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h3>{{label}}</h3>
tags:{
type:Array,
notify: true,
value:[],
value:function(){return []},
},
/**
* the CSS color for the tag, e.g. #e5e5e5
Expand Down
17 changes: 14 additions & 3 deletions test/basic-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
</template>
</test-fixture>

<test-fixture id="wrong-tags">
<template>
<paper-tags-input> </paper-tags-input>
</template>
</test-fixture>

<script>
suite('<paper-tags-input>', function() {
var myEl;
Expand Down Expand Up @@ -96,11 +102,16 @@
setup(function() {
myEl = fixture('duplicate');
});
test('multiple paper-tags-input in the same page should not share tags variable when tags property is not given', function() {
assert.equal(myEl.tags.length, 0);
assert.deepEqual(myEl.tags, []);
});
test('should not allow to add duplicate tag', function() {
// myEl._addTag("Hello World");
// myEl._addTag("Hello World");
// assert.deepEqual(myEl.tags, []);
// myEl._addTag('QianBenLuLu');
// assert.deepEqual(myEl.tags[0], 'QianBenLuLu');
// assert.equal(myEl.tags.length, 1);
// assert.deepEqual(myEl.tags.length, 1);
// myEl._addTag('QianBenLuLu');
// var input = myEl.querySelector('paper-input');
// assert.equal(input.errorMessage, myEl.duplicateErrorMessage);
// assert.equal(input.invalid, true);
Expand Down

0 comments on commit 4dfc97a

Please sign in to comment.