forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-modal-tests.ts
104 lines (91 loc) · 2.34 KB
/
angular-modal-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../angularjs/angular.d.ts" />
/// <reference path="angular-modal.d.ts" />
var btfModal: angularModal.AngularModalFactory;
// Using template URL
function withTemplateUrl() {
btfModal({
controller: 'SomeController',
controllerAs: 'vm',
templateUrl: 'some-template.html'
});
}
// Using template
function withTemplate() {
btfModal({
controller: 'SomeController',
controllerAs: 'vm',
template: '<div></div>'
});
}
// Using controller function
function withControllerAsFunction() {
btfModal({
controller: function () {},
template: '<div></div>'
})
}
// Using constructor function
function withControllerClass() {
class TestController {
constructor(dependency1:any, dependency2:any) {}
}
btfModal({
controller: TestController,
template: '<div></div>'
});
}
// With container as selector
function withContainerAsString() {
btfModal({
template: '<div></div>',
container: '.container'
});
}
// With container as jQuery element
function withContainerAsJquery() {
var container: JQuery = $('body');
btfModal({
template: '<div></div>',
container: container
});
}
// With container as DOM Element
function withContainerAsDom() {
var container: Element = document.getElementById('container');
btfModal({
template: '<div></div>',
container: container
});
}
// With container as DOM Element Array
function withContainerAsDomArray() {
var container: Element[] = [document.getElementById('container'), document.getElementById('container2')];
btfModal({
template: '<div></div>',
container: container
});
}
// With container as function
function withContainerAsFunction() {
btfModal({
template: '<div></div>',
container: function() {}
});
}
// With container as array
function withContainerAsArray() {
btfModal({
template: '<div></div>',
container: ['1', 2]
});
}
// Calling return values
function callingValues() {
var modal: angularModal.AngularModal = btfModal({
template: '<div></div>'
});
modal.activate().then(() => {}, () => {});
modal.deactivate().then(() => {}, () => {});
var isActive: boolean = modal.active();
}