Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
add label visibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Yip committed Oct 16, 2014
1 parent 2e29bdf commit 8af4689
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions test/decorator.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,31 @@
<paper-input-decorator id="decorator2" label="input">
</paper-input-decorator>

<br>

<paper-input-decorator id="decorator3" label="input" floatingLabel>
<input id="input3" is="core-input">
</paper-input-decorator>

<script>

var d1 = document.getElementById('decorator1');
var i1 = document.getElementById('input1');
var d2 = document.getElementById('decorator2');
var d3 = document.getElementById('decorator3');
var i3 = document.getElementById('input3');

function reset(d, i) {
d.labelVisible = null;
i.value = null;
d.updateLabelVisibility(i.value);
}

suite('basic', function() {

teardown(function() {
d1.labelVisible = null;
i1.value = null;
d1.updateLabelVisibility(i1.value);
reset(d1, i1);
reset(d3, i3);
});

test('label is invisible if value is not null', function() {
Expand All @@ -60,7 +73,21 @@
assert.ok(!d1._labelVisible);
});

// set label = integer 0
test('label is invisible if floating label and focused', function(done) {
assert.ok(d3._labelVisible);
d3.focusAction();
asyncPlatformFlush(function() {
assert.ok(!d3._labelVisible);
done();
});
});

test('label is invisible if value = 0', function() {
assert.ok(d1._labelVisible);
i1.value = 0;
d1.updateLabelVisibility(i1.value);
assert.ok(!d1._labelVisible);
});

test('labelVisible overrides label visibility', function() {
d1.labelVisible = false;
Expand Down

0 comments on commit 8af4689

Please sign in to comment.