From bedc31f3efaac291e79962bc6ebcda2bb67c9850 Mon Sep 17 00:00:00 2001 From: Matthew Pull Date: Tue, 24 Jan 2017 20:45:49 +0000 Subject: [PATCH 1/4] Add sizingImage and positionImage properties --- paper-card.html | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/paper-card.html b/paper-card.html index e3c0b23..75397e2 100644 --- a/paper-card.html +++ b/paper-card.html @@ -136,7 +136,9 @@ alt="[[alt]]" placeholder="[[placeholderImage]]" preload="[[preloadImage]]" - fade="[[fadeImage]]"> + fade="[[fadeImage]]" + sizing="[[sizingImage]]" + position="[[positionImage]]">
[[heading]]
@@ -199,6 +201,26 @@ value: null }, + /** + * Sets a sizing option for the image. Valid values are `contain` (full + * aspect ratio of the image is contained within the element and + * letterboxed) or `cover` (image is cropped in order to fully cover the + * bounds of the element), or `null` (default: image takes natural size). + */ + sizingImage: { + type: String, + value: null, + reflectToAttribute: true + }, + /** + * When a sizing option is used (`cover` or `contain`), this determines + * how the image is aligned within the element bounds. + */ + positionImage: { + type: String, + value: 'center' + }, + /** * The z-depth of the card, from 0-5. */ @@ -228,7 +250,7 @@ computed: '_computeAnimated(animatedShadow)' } }, - + /** * Format function for aria-hidden. Use the ! operator results in the * empty string when given a falsy value. From c7ceb76387869b40cbc7094f2cf20009df5b1218 Mon Sep 17 00:00:00 2001 From: Matthew Pull Date: Tue, 24 Jan 2017 20:47:48 +0000 Subject: [PATCH 2/4] Add test cases for sizingImage and positionImage --- test/basic.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/basic.html b/test/basic.html index 525225b..3cf434e 100644 --- a/test/basic.html +++ b/test/basic.html @@ -51,7 +51,7 @@ f.heading = 'batman'; assert.strictEqual(f.getAttribute('aria-label'), 'batman'); }); - + test('aria-hidden is set on image', function() { assert.strictEqual(img.getAttribute('aria-hidden'), 'true'); }); @@ -97,6 +97,18 @@ assert.strictEqual(img.placeholder, f.placeholderImage); }); + test('sizing properly setup', function() { + assert.strictEqual(img.sizing, null); + f.sizingImage = 'some-sizing'; + assert.strictEqual(img.sizing, f.sizingImage); + }); + + test('position properly setup', function() { + assert.strictEqual(img.position, null); + f.positionImage = 'some-position'; + assert.strictEqual(img.position, f.positionImage); + }); + test('alt properly setup', function() { assert.strictEqual(img.alt, null); f.alt = 'some-text'; From 0c2cd2319c10be20789aec6799909935d0e13b9d Mon Sep 17 00:00:00 2001 From: Matthew Pull Date: Tue, 24 Jan 2017 20:54:59 +0000 Subject: [PATCH 3/4] Sets defaults at null --- paper-card.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/paper-card.html b/paper-card.html index 75397e2..1676c7a 100644 --- a/paper-card.html +++ b/paper-card.html @@ -209,8 +209,7 @@ */ sizingImage: { type: String, - value: null, - reflectToAttribute: true + value: null }, /** * When a sizing option is used (`cover` or `contain`), this determines @@ -218,7 +217,7 @@ */ positionImage: { type: String, - value: 'center' + value: null }, /** From dfd3ffb67412acb58de62f629969957d9bbbe12f Mon Sep 17 00:00:00 2001 From: Matthew Pull Date: Fri, 27 Jan 2017 21:39:48 +0000 Subject: [PATCH 4/4] Bump bower version to 1.1.5 --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 1498f99..acc33c9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "paper-card", - "version": "1.1.4", + "version": "1.1.5", "description": "Material design piece of paper with unique related data", "authors": [ "The Polymer Authors"