Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Expose sizing and position properties from iron-image (update) #92

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion paper-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@
alt="[[alt]]"
placeholder="[[placeholderImage]]"
preload="[[preloadImage]]"
fade="[[fadeImage]]"></iron-image>
fade="[[fadeImage]]"
sizing="[[sizingImage]]"
position="[[positionImage]]"></iron-image>
<div hidden$="[[!heading]]" class$="title-text [[_computeHeadingClass(image)]]">[[heading]]</div>
</div>

Expand Down Expand Up @@ -219,6 +221,25 @@
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
},
/**
* When a sizing option is used (`cover` or `contain`), this determines
* how the image is aligned within the element bounds.
*/
positionImage: {
type: String,
value: null
},

/**
* The z-depth of the card, from 0-5.
*/
Expand Down
12 changes: 12 additions & 0 deletions test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,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';
Expand Down