From fdebb3f486f19e8891918ca56d6a8a7fa24961f2 Mon Sep 17 00:00:00 2001 From: Chad Weimer Date: Sun, 1 Jul 2018 08:38:53 -0700 Subject: [PATCH] Added the ability to mark the element as readonly --- demo/index.html | 6 ++++++ iron-star-rating.html | 18 +++++++++++++++--- test/iron-star-rating_test.html | 31 ++++++++++++++++++------------- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/demo/index.html b/demo/index.html index fc72496..27df8c2 100644 --- a/demo/index.html +++ b/demo/index.html @@ -32,6 +32,12 @@

Pre-assigned rating demo

+

Readonly demo

+ + +

Custom icon demo

- + + + + + @@ -30,19 +36,18 @@ test('instantiating the element with default properties works', function() { var element = fixture('BasicTestFixture'); - assert.equal(element.prop1, 'iron-star-rating'); - var elementShadowRoot = element.shadowRoot; - var elementHeader = elementShadowRoot.querySelector('h2'); - assert.equal(elementHeader.innerHTML, 'Hello iron-star-rating!'); + assert.equal(element.value, 0); + assert.equal(element.readonly, false); + }); + + test('setting a value on the element works', function() { + var element = fixture('InitialValueTestFixture'); + assert.equal(element.value, 3); }); - test('setting a property on the element works', function() { - // Create a test fixture - var element = fixture('ChangedPropertyTestFixture'); - assert.equal(element.prop1, 'new-prop1'); - var elementShadowRoot = element.shadowRoot; - var elementHeader = elementShadowRoot.querySelector('h2'); - assert.equal(elementHeader.innerHTML, 'Hello new-prop1!'); + test('setting readonly on the element works', function() { + var element = fixture('ReadonlyTestFixture'); + assert.equal(element.readonly, true); }); });