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

Commit 3387109

Browse files
devversionkara
authored andcommitted
feat(interim): support multiple as a default preset method (#9737)
* Dialogs, Bottom-Sheets and Toasts have presets, which all depend on the `build` preset automatically. * Due to the new `muliple` property in the `$$interimElement` factory, developers can explicitly pass the multiple property per JSON, but not as a preset method.
1 parent 24370e7 commit 3387109

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

src/core/services/interimElement/interimElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function InterimElementProvider() {
5353
* all interim elements will come with the 'build' preset
5454
*/
5555
provider.addPreset('build', {
56-
methods: ['controller', 'controllerAs', 'resolve',
56+
methods: ['controller', 'controllerAs', 'resolve', 'multiple',
5757
'template', 'templateUrl', 'themable', 'transformTemplate', 'parent', 'contentElement']
5858
});
5959

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,53 @@ describe('$$interimElement service', function() {
250250
});
251251
});
252252

253+
it('should support multiple interims as a preset method', function() {
254+
255+
var showCount = 0;
256+
257+
createInterimProvider('interimTest');
258+
259+
inject(function(interimTest) {
260+
261+
showInterim(interimTest);
262+
expect(showCount).toBe(1);
263+
264+
showInterim(interimTest);
265+
expect(showCount).toBe(2);
266+
267+
interimTest.hide();
268+
flush();
269+
270+
expect(showCount).toBe(1);
271+
272+
interimTest.hide();
273+
flush();
274+
275+
expect(showCount).toBe(0);
276+
277+
});
278+
279+
function showInterim(service) {
280+
281+
var preset = service
282+
.build()
283+
.template('<div>Interim Element</div>')
284+
.multiple(true);
285+
286+
preset._options.onShow = function() {
287+
showCount++;
288+
};
289+
290+
preset._options.onRemove = function() {
291+
showCount--;
292+
};
293+
294+
service.show(preset);
295+
flush();
296+
}
297+
298+
});
299+
253300
});
254301

255302
describe('a service', function() {

0 commit comments

Comments
 (0)