limit resume to 8
This commit is contained in:
parent
dd2b5bc15e
commit
fb269362ff
7 changed files with 62 additions and 25 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-overlay-behavior",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"description": "Provides a behavior for making an element an overlay",
|
||||
"private": true,
|
||||
|
@ -35,11 +35,11 @@
|
|||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
|
||||
"_release": "1.4.1",
|
||||
"_release": "1.4.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.4.1",
|
||||
"commit": "4aefb7bc41aecef69022d6435133c430fc52d3ba"
|
||||
"tag": "v1.4.2",
|
||||
"commit": "565869d04433fb1065210ca30d81e7b7c4af73f8"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-overlay-behavior",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"description": "Provides a behavior for making an element an overlay",
|
||||
"private": true,
|
||||
|
|
|
@ -243,6 +243,8 @@ context. You should place this element as a child of `<body>` whenever possible.
|
|||
},
|
||||
|
||||
ready: function() {
|
||||
// Used to skip calls to notifyResize and refit while the overlay is animating.
|
||||
this.__isAnimating = false;
|
||||
// with-backdrop needs tabindex to be set in order to trap the focus.
|
||||
// If it is not set, IronOverlayBehavior will set it, and remove it if with-backdrop = false.
|
||||
this.__shouldRemoveTabIndex = false;
|
||||
|
@ -328,6 +330,7 @@ context. You should place this element as a child of `<body>` whenever possible.
|
|||
|
||||
this._manager.trackBackdrop(this);
|
||||
|
||||
this.__isAnimating = true;
|
||||
if (this.opened) {
|
||||
this._prepareRenderOpened();
|
||||
}
|
||||
|
@ -410,7 +413,7 @@ context. You should place this element as a child of `<body>` whenever possible.
|
|||
// Needed to calculate the size of the overlay so that transitions on its size
|
||||
// will have the correct starting points.
|
||||
this._preparePositioning();
|
||||
this.fit();
|
||||
this.refit();
|
||||
this._finishPositioning();
|
||||
|
||||
if (this.withBackdrop) {
|
||||
|
@ -441,24 +444,23 @@ context. You should place this element as a child of `<body>` whenever possible.
|
|||
},
|
||||
|
||||
_finishRenderOpened: function() {
|
||||
// This ensures the overlay is visible before we set the focus
|
||||
// (by calling _onIronResize -> refit).
|
||||
this.notifyResize();
|
||||
// Focus the child node with [autofocus]
|
||||
this._applyFocus();
|
||||
|
||||
this.notifyResize();
|
||||
this.__isAnimating = false;
|
||||
this.fire('iron-overlay-opened');
|
||||
},
|
||||
|
||||
_finishRenderClosed: function() {
|
||||
// Hide the overlay and remove the backdrop.
|
||||
this.resetFit();
|
||||
this.style.display = 'none';
|
||||
this._manager.removeOverlay(this);
|
||||
|
||||
this._applyFocus();
|
||||
this.notifyResize();
|
||||
|
||||
this.notifyResize();
|
||||
this.__isAnimating = false;
|
||||
this.fire('iron-overlay-closed', this.closingReason);
|
||||
},
|
||||
|
||||
|
@ -513,6 +515,10 @@ context. You should place this element as a child of `<body>` whenever possible.
|
|||
},
|
||||
|
||||
_onIronResize: function() {
|
||||
if (this.__isAnimating) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.opened) {
|
||||
this.refit();
|
||||
}
|
||||
|
@ -524,7 +530,7 @@ context. You should place this element as a child of `<body>` whenever possible.
|
|||
* Can be overridden in order to avoid multiple observers on the same node.
|
||||
*/
|
||||
_onNodesChange: function() {
|
||||
if (this.opened) {
|
||||
if (this.opened && !this.__isAnimating) {
|
||||
this.notifyResize();
|
||||
}
|
||||
// Store it so we don't query too much.
|
||||
|
|
|
@ -165,8 +165,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
|
||||
test('open() triggers iron-resize', function(done) {
|
||||
// Ignore the iron-resize on attached.
|
||||
var callCount = -1;
|
||||
var callCount = 0;
|
||||
// Ignore iron-resize triggered by window resize.
|
||||
window.addEventListener('resize', function() { callCount--; }, true);
|
||||
overlay.addEventListener('iron-resize', function() { callCount++; });
|
||||
|
@ -353,16 +352,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
test('overlay positioned & sized properly', function(done) {
|
||||
overlay.addEventListener('iron-overlay-opened', function() {
|
||||
var s = getComputedStyle(overlay);
|
||||
assert.equal(parseFloat(s.left), (window.innerWidth - overlay.offsetWidth) / 2, 'centered horizontally');
|
||||
assert.equal(parseFloat(s.top), (window.innerHeight - overlay.offsetHeight) / 2, 'centered vertically');
|
||||
assert.closeTo(parseFloat(s.left), (window.innerWidth - overlay.offsetWidth) / 2, 1, 'centered horizontally');
|
||||
assert.closeTo(parseFloat(s.top), (window.innerHeight - overlay.offsetHeight) / 2, 1, 'centered vertically');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('open overlay refits on iron-resize', function() {
|
||||
test('open overlay refits on iron-resize', function(done) {
|
||||
var spy = sinon.spy(overlay, 'refit');
|
||||
// At this point, overlay is still opening.
|
||||
overlay.fire('iron-resize');
|
||||
assert.isTrue(spy.called, 'overlay should refit');
|
||||
assert.isFalse(spy.called, 'overlay did not refit while animating');
|
||||
overlay.addEventListener('iron-overlay-opened', function() {
|
||||
overlay.fire('iron-resize');
|
||||
assert.isTrue(spy.called, 'overlay did refit');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -664,10 +669,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
test('backdrop is removed when toggling overlay opened', function(done) {
|
||||
overlay.open();
|
||||
assert.isObject(overlay.backdropElement.parentNode, 'backdrop is immediately inserted in the document');
|
||||
assert.isOk(overlay.backdropElement.parentNode, 'backdrop is immediately inserted in the document');
|
||||
runAfterClose(overlay, function() {
|
||||
assert.isFalse(overlay.backdropElement.opened, 'backdrop is closed');
|
||||
assert.isNotObject(overlay.backdropElement.parentNode, 'backdrop is removed from document');
|
||||
assert.isNotOk(overlay.backdropElement.parentNode, 'backdrop is removed from document');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue