Skip to content

Commit

Permalink
Merge pull request #83 from PolymerElements/auto-cleanup
Browse files Browse the repository at this point in the history
Automatic format!
  • Loading branch information
Elliott Marquez authored Apr 11, 2018
2 parents dae81f7 + bc3dd28 commit 9c22c30
Show file tree
Hide file tree
Showing 11 changed files with 1,648 additions and 269 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ before_script:
npm run update-types && git diff --exit-code || (echo -e
'\n\033[31mERROR:\033[0m Typings are stale. Please run "npm run
update-types".' && false)
- >-
npm run format && git diff --exit-code || (echo -e '\n\033[31mERROR:\033[0m
Typings are stale. Please run "npm run format".' && false)
env:
global:
- secure: >-
Expand Down
13 changes: 3 additions & 10 deletions demo/simple-expand-collapse.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,9 @@

properties: {

horizontal: {
type: Boolean
},
opened: {
type: Boolean,
reflectToAttribute: true
},
noAnimation: {
type: Boolean
},
horizontal: {type: Boolean},
opened: {type: Boolean, reflectToAttribute: true},
noAnimation: {type: Boolean},
},

toggle: function() {
Expand Down
4 changes: 2 additions & 2 deletions iron-collapse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ interface IronCollapseElement extends Polymer.Element, Polymer.IronResizableBeha
updateSize(size: string, animated?: boolean): void;

/**
* enableTransition() is deprecated, but left over so it doesn't break existing code.
* Please use `noAnimation` property instead.
* enableTransition() is deprecated, but left over so it doesn't break
* existing code. Please use `noAnimation` property instead.
*/
enableTransition(enabled: any): void;
_updateTransition(enabled: any): void;
Expand Down
56 changes: 18 additions & 38 deletions iron-collapse.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,11 @@
</dom-module>

<script>

Polymer({

is: 'iron-collapse',

behaviors: [
Polymer.IronResizableBehavior
],
behaviors: [Polymer.IronResizableBehavior],

properties: {

Expand All @@ -103,53 +100,36 @@
*
* @attribute horizontal
*/
horizontal: {
type: Boolean,
value: false,
observer: '_horizontalChanged'
},
horizontal: {type: Boolean, value: false, observer: '_horizontalChanged'},

/**
* Set opened to true to show the collapse element and to false to hide it.
*
* @attribute opened
*/
opened: {
type: Boolean,
value: false,
notify: true,
observer: '_openedChanged'
},
opened:
{type: Boolean, value: false, notify: true, observer: '_openedChanged'},

/**
* When true, the element is transitioning its opened state. When false,
* the element has finished opening/closing.
*
* @attribute transitioning
*/
transitioning: {
type: Boolean,
notify: true,
readOnly: true
},
transitioning: {type: Boolean, notify: true, readOnly: true},

/**
* Set noAnimation to true to disable animations.
*
* @attribute noAnimation
*/
noAnimation: {
type: Boolean
},
noAnimation: {type: Boolean},

/**
* Stores the desired size of the collapse body.
* @private
*/
_desiredSize: {
type: String,
value: ''
}
_desiredSize: {type: String, value: ''}
},

get dimension() {
Expand Down Expand Up @@ -177,9 +157,7 @@
'aria-hidden': 'true',
},

listeners: {
transitionend: '_onTransitionEnd'
},
listeners: {transitionend: '_onTransitionEnd'},

/**
* Toggle the opened state.
Expand Down Expand Up @@ -207,8 +185,8 @@
// Consider 'auto' as '', to take full size.
size = size === 'auto' ? '' : size;

var willAnimate = animated && !this.noAnimation &&
this.isAttached && this._desiredSize !== size;
var willAnimate = animated && !this.noAnimation && this.isAttached &&
this._desiredSize !== size;

this._desiredSize = size;

Expand All @@ -218,7 +196,8 @@
// Animation will start at the current size.
var startSize = this._calcSize();
// For `auto` we must calculate what is the final size for the animation.
// After the transition is done, _transitionEnd will set the size back to `auto`.
// After the transition is done, _transitionEnd will set the size back to
// `auto`.
if (size === '') {
this.style[this._dimensionMax] = '';
size = this._calcSize();
Expand All @@ -242,14 +221,15 @@
},

/**
* enableTransition() is deprecated, but left over so it doesn't break existing code.
* Please use `noAnimation` property instead.
* enableTransition() is deprecated, but left over so it doesn't break
* existing code. Please use `noAnimation` property instead.
*
* @method enableTransition
* @deprecated since version 1.0.4
*/
enableTransition: function(enabled) {
Polymer.Base._warn('`enableTransition()` is deprecated, use `noAnimation` instead.');
Polymer.Base._warn(
'`enableTransition()` is deprecated, use `noAnimation` instead.');
this.noAnimation = !enabled;
},

Expand All @@ -259,7 +239,8 @@

_horizontalChanged: function() {
this.style.transitionProperty = this._dimensionMaxCss;
var otherDimension = this._dimensionMax === 'maxWidth' ? 'maxHeight' : 'maxWidth';
var otherDimension =
this._dimensionMax === 'maxWidth' ? 'maxHeight' : 'maxWidth';
this.style[otherDimension] = '';
this.updateSize(this.opened ? 'auto' : '0px', false);
},
Expand Down Expand Up @@ -298,5 +279,4 @@
}

});

</script>
Loading

0 comments on commit 9c22c30

Please sign in to comment.