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

Commit ebc8ace

Browse files
devversionkara
authored andcommitted
fix(interim): do not immediately splice interim. (#9670)
* SHA 421fed4 introduced multiple interim elements support (internal right now) * If multiple interim elements are showing up, the last one can't be closed in some situations (because we accidentally splice it too early)
1 parent df9b9cd commit ebc8ace

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/core/services/interimElement/interimElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ function InterimElementProvider() {
349349
}
350350

351351
// Hide the latest showing interim element.
352-
return closeElement(showingInterims.pop());
352+
return closeElement(showingInterims[showingInterims.length - 1]);
353353

354354
function closeElement(interim) {
355355

src/core/services/interimElement/interimElement.spec.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,35 @@ describe('$$interimElement service', function() {
365365
}
366366
});
367367

368+
it('should hide multiple elements', function() {
369+
var showCount = 0;
370+
371+
showInterim();
372+
expect(showCount).toBe(1);
373+
374+
showInterim();
375+
expect(showCount).toBe(2);
376+
377+
Service.hide();
378+
expect(showCount).toBe(1);
379+
380+
Service.hide();
381+
expect(showCount).toBe(0);
382+
383+
function showInterim() {
384+
Service.show({
385+
template: '<div>Interim Element</div>',
386+
onShow: function() {
387+
showCount++;
388+
},
389+
onRemove: function() {
390+
showCount--;
391+
},
392+
multiple: true
393+
});
394+
}
395+
396+
});
368397

369398
it('should not show multiple interim elements by default', function() {
370399
var showCount = 0;

0 commit comments

Comments
 (0)