@coolon/angular-ui-powerups 12.4.0-alpha.2 → 12.4.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/assets/empty-state.scss +11 -0
  2. package/assets/styles.scss +1 -0
  3. package/bundles/coolon-angular-ui-powerups-cypress.umd.js +643 -306
  4. package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.js +7 -11
  6. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  7. package/coolon-angular-ui-powerups.metadata.json +1 -1
  8. package/cypress/builder.d.ts +44 -0
  9. package/cypress/components/aup-abstract-activity.d.ts +9 -0
  10. package/cypress/components/aup-abstract-table.d.ts +18 -0
  11. package/cypress/components/aup-activity.d.ts +9 -0
  12. package/cypress/components/aup-alert-dialog.d.ts +7 -0
  13. package/cypress/components/aup-alert.d.ts +9 -0
  14. package/cypress/components/aup-command-face.d.ts +2 -8
  15. package/cypress/components/aup-command.d.ts +1 -1
  16. package/cypress/components/aup-empty-state.d.ts +4 -0
  17. package/cypress/components/aup-input.d.ts +11 -5
  18. package/cypress/components/aup-modal-activity.d.ts +4 -0
  19. package/cypress/components/aup-table.d.ts +5 -18
  20. package/cypress/components/aup-tree-table.d.ts +16 -0
  21. package/cypress/components/button.d.ts +10 -7
  22. package/cypress/components/form-element-mixin.d.ts +21 -0
  23. package/cypress/components/mat-checkbox.d.ts +30 -0
  24. package/cypress/components/popup/aup-abstract-popup-menu.d.ts +15 -0
  25. package/cypress/components/popup/aup-more-menu.d.ts +5 -0
  26. package/cypress/components/popup/aup-popup-menu-panel.d.ts +3 -0
  27. package/cypress/components/popup/aup-popup-menu.d.ts +7 -0
  28. package/cypress/components/table/aup-table-cell.d.ts +9 -0
  29. package/cypress/components/table/aup-table-column.d.ts +10 -0
  30. package/cypress/components/table/aup-table-row.d.ts +17 -0
  31. package/cypress/components/table/aup-table-selection-cell.d.ts +5 -0
  32. package/cypress/components/table/aup-table-selection-column.d.ts +5 -0
  33. package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
  34. package/cypress/element-locator.d.ts +8 -0
  35. package/cypress/exports.d.ts +22 -4
  36. package/cypress/page-builder.d.ts +8 -0
  37. package/cypress/page-element.d.ts +10 -12
  38. package/cypress/page.d.ts +5 -33
  39. package/esm2015/cypress/builder.js +81 -0
  40. package/esm2015/cypress/builder.js.map +1 -0
  41. package/esm2015/cypress/builder.metadata.json +1 -0
  42. package/esm2015/cypress/components/aup-abstract-activity.js +12 -0
  43. package/esm2015/cypress/components/aup-abstract-activity.js.map +1 -0
  44. package/esm2015/cypress/components/aup-abstract-activity.metadata.json +1 -0
  45. package/esm2015/cypress/components/aup-abstract-table.js +50 -0
  46. package/esm2015/cypress/components/aup-abstract-table.js.map +1 -0
  47. package/esm2015/cypress/components/aup-abstract-table.metadata.json +1 -0
  48. package/esm2015/cypress/components/aup-activity.js +13 -0
  49. package/esm2015/cypress/components/aup-activity.js.map +1 -0
  50. package/esm2015/cypress/components/aup-activity.metadata.json +1 -0
  51. package/esm2015/cypress/components/aup-alert-dialog.js +12 -0
  52. package/esm2015/cypress/components/aup-alert-dialog.js.map +1 -0
  53. package/esm2015/cypress/components/aup-alert-dialog.metadata.json +1 -0
  54. package/esm2015/cypress/components/aup-alert.js +13 -0
  55. package/esm2015/cypress/components/aup-alert.js.map +1 -0
  56. package/esm2015/cypress/components/aup-alert.metadata.json +1 -0
  57. package/esm2015/cypress/components/aup-command-face.js +11 -22
  58. package/esm2015/cypress/components/aup-command-face.js.map +1 -1
  59. package/esm2015/cypress/components/aup-command-face.metadata.json +1 -1
  60. package/esm2015/cypress/components/aup-command.js +9 -6
  61. package/esm2015/cypress/components/aup-command.js.map +1 -1
  62. package/esm2015/cypress/components/aup-command.metadata.json +1 -1
  63. package/esm2015/cypress/components/aup-empty-state.js +7 -0
  64. package/esm2015/cypress/components/aup-empty-state.js.map +1 -0
  65. package/esm2015/cypress/components/aup-empty-state.metadata.json +1 -0
  66. package/esm2015/cypress/components/aup-input.js +17 -5
  67. package/esm2015/cypress/components/aup-input.js.map +1 -1
  68. package/esm2015/cypress/components/aup-input.metadata.json +1 -1
  69. package/esm2015/cypress/components/aup-modal-activity.js +7 -0
  70. package/esm2015/cypress/components/aup-modal-activity.js.map +1 -0
  71. package/esm2015/cypress/components/aup-modal-activity.metadata.json +1 -0
  72. package/esm2015/cypress/components/aup-navigation.js +1 -1
  73. package/esm2015/cypress/components/aup-navigation.js.map +1 -1
  74. package/esm2015/cypress/components/aup-table.js +5 -33
  75. package/esm2015/cypress/components/aup-table.js.map +1 -1
  76. package/esm2015/cypress/components/aup-table.metadata.json +1 -1
  77. package/esm2015/cypress/components/aup-tree-table.js +34 -0
  78. package/esm2015/cypress/components/aup-tree-table.js.map +1 -0
  79. package/esm2015/cypress/components/aup-tree-table.metadata.json +1 -0
  80. package/esm2015/cypress/components/button.js +4 -10
  81. package/esm2015/cypress/components/button.js.map +1 -1
  82. package/esm2015/cypress/components/button.metadata.json +1 -1
  83. package/esm2015/cypress/components/form-element-mixin.js +11 -0
  84. package/esm2015/cypress/components/form-element-mixin.js.map +1 -0
  85. package/esm2015/cypress/components/form-element-mixin.metadata.json +1 -0
  86. package/esm2015/cypress/components/mat-checkbox.js +34 -0
  87. package/esm2015/cypress/components/mat-checkbox.js.map +1 -0
  88. package/esm2015/cypress/components/mat-checkbox.metadata.json +1 -0
  89. package/esm2015/cypress/components/popup/aup-abstract-popup-menu.js +33 -0
  90. package/esm2015/cypress/components/popup/aup-abstract-popup-menu.js.map +1 -0
  91. package/esm2015/cypress/components/popup/aup-abstract-popup-menu.metadata.json +1 -0
  92. package/esm2015/cypress/components/popup/aup-more-menu.js +8 -0
  93. package/esm2015/cypress/components/popup/aup-more-menu.js.map +1 -0
  94. package/esm2015/cypress/components/popup/aup-more-menu.metadata.json +1 -0
  95. package/esm2015/cypress/components/popup/aup-popup-menu-panel.js +4 -0
  96. package/esm2015/cypress/components/popup/aup-popup-menu-panel.js.map +1 -0
  97. package/esm2015/cypress/components/popup/aup-popup-menu-panel.metadata.json +1 -0
  98. package/esm2015/cypress/components/popup/aup-popup-menu.js +12 -0
  99. package/esm2015/cypress/components/popup/aup-popup-menu.js.map +1 -0
  100. package/esm2015/cypress/components/popup/aup-popup-menu.metadata.json +1 -0
  101. package/esm2015/cypress/components/table/aup-table-cell.js +14 -0
  102. package/esm2015/cypress/components/table/aup-table-cell.js.map +1 -0
  103. package/esm2015/cypress/components/table/aup-table-cell.metadata.json +1 -0
  104. package/esm2015/cypress/components/table/aup-table-column.js +19 -0
  105. package/esm2015/cypress/components/table/aup-table-column.js.map +1 -0
  106. package/esm2015/cypress/components/table/aup-table-column.metadata.json +1 -0
  107. package/esm2015/cypress/components/table/aup-table-row.js +28 -0
  108. package/esm2015/cypress/components/table/aup-table-row.js.map +1 -0
  109. package/esm2015/cypress/components/table/aup-table-row.metadata.json +1 -0
  110. package/esm2015/cypress/components/table/aup-table-selection-cell.js +6 -0
  111. package/esm2015/cypress/components/table/aup-table-selection-cell.js.map +1 -0
  112. package/esm2015/cypress/components/table/aup-table-selection-cell.metadata.json +1 -0
  113. package/esm2015/cypress/components/table/aup-table-selection-column.js +6 -0
  114. package/esm2015/cypress/components/table/aup-table-selection-column.js.map +1 -0
  115. package/esm2015/cypress/components/table/aup-table-selection-column.metadata.json +1 -0
  116. package/esm2015/cypress/element-locator.js +16 -0
  117. package/esm2015/cypress/element-locator.js.map +1 -0
  118. package/esm2015/cypress/element-locator.metadata.json +1 -0
  119. package/esm2015/cypress/exports.js +22 -4
  120. package/esm2015/cypress/exports.js.map +1 -1
  121. package/esm2015/cypress/exports.metadata.json +1 -1
  122. package/esm2015/cypress/page-builder.js +15 -0
  123. package/esm2015/cypress/page-builder.js.map +1 -0
  124. package/esm2015/cypress/page-builder.metadata.json +1 -0
  125. package/esm2015/cypress/page-element.js +22 -19
  126. package/esm2015/cypress/page-element.js.map +1 -1
  127. package/esm2015/cypress/page-element.metadata.json +1 -1
  128. package/esm2015/cypress/page.js +8 -10
  129. package/esm2015/cypress/page.js.map +1 -1
  130. package/esm2015/cypress/page.metadata.json +1 -1
  131. package/esm2015/cypress/path.js +3 -1
  132. package/esm2015/cypress/path.js.map +1 -1
  133. package/esm2015/lib/components/empty-state/empty-state.component.js +1 -1
  134. package/esm2015/lib/components/empty-state/empty-state.component.metadata.json +1 -1
  135. package/esm2015/lib/components/tables/tree-table/flattened-tree-list-model.js +4 -4
  136. package/esm2015/lib/components/tables/tree-table/flattened-tree-list-model.js.map +1 -1
  137. package/esm2015/lib/components/tables/tree-table/flattened-tree-list-model.metadata.json +1 -1
  138. package/esm2015/lib/components/tables/tree-table/tree-table-model.js +1 -0
  139. package/esm2015/lib/components/tables/tree-table/tree-table-model.js.map +1 -1
  140. package/esm2015/lib/components/tables/tree-table/tree-table-model.metadata.json +1 -1
  141. package/esm2015/lib/place/url-snapshot.js +1 -7
  142. package/esm2015/lib/place/url-snapshot.js.map +1 -1
  143. package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
  144. package/fesm2015/coolon-angular-ui-powerups-cypress.js +482 -221
  145. package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
  146. package/fesm2015/coolon-angular-ui-powerups.js +7 -11
  147. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  148. package/lib/components/tables/tree-table/flattened-tree-list-model.d.ts +0 -1
  149. package/lib/components/tables/tree-table/tree-table-model.d.ts +4 -5
  150. package/package.json +1 -1
  151. package/cypress/components/aup-more-menu.d.ts +0 -4
  152. package/cypress/components/aup-popup-menu.d.ts +0 -7
  153. package/cypress/components/button-mixin.d.ts +0 -19
  154. package/cypress/section.d.ts +0 -51
  155. package/esm2015/cypress/components/aup-more-menu.js +0 -7
  156. package/esm2015/cypress/components/aup-more-menu.js.map +0 -1
  157. package/esm2015/cypress/components/aup-more-menu.metadata.json +0 -1
  158. package/esm2015/cypress/components/aup-popup-menu.js +0 -19
  159. package/esm2015/cypress/components/aup-popup-menu.js.map +0 -1
  160. package/esm2015/cypress/components/aup-popup-menu.metadata.json +0 -1
  161. package/esm2015/cypress/components/button-mixin.js +0 -15
  162. package/esm2015/cypress/components/button-mixin.js.map +0 -1
  163. package/esm2015/cypress/components/button-mixin.metadata.json +0 -1
  164. package/esm2015/cypress/section.js +0 -58
  165. package/esm2015/cypress/section.js.map +0 -1
  166. package/esm2015/cypress/section.metadata.json +0 -1
@@ -1,27 +1,44 @@
1
- import { lang, Mixin } from '@coolon/typescript-utilities';
1
+ import { Stringy, Mixin } from '@coolon/typescript-utilities';
2
2
  import * as _ from 'lodash';
3
+ import { __decorate, __metadata } from 'tslib';
4
+ import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
3
5
  import { DefaultUrlSerializer } from '@angular/router';
4
6
 
7
+ var ElementLocator;
8
+ (function (ElementLocator) {
9
+ function findByCssSelector(selector) {
10
+ return parent => parent.dom().find(selector);
11
+ }
12
+ ElementLocator.findByCssSelector = findByCssSelector;
13
+ function findByTextContent(text) {
14
+ return parent => parent.dom().contains(text);
15
+ }
16
+ ElementLocator.findByTextContent = findByTextContent;
17
+ function findBySelectorAndTextContent(selector, text) {
18
+ return parent => parent.dom().contains(selector, text);
19
+ }
20
+ ElementLocator.findBySelectorAndTextContent = findBySelectorAndTextContent;
21
+ })(ElementLocator || (ElementLocator = {}));
22
+
5
23
  class PageElement {
6
- constructor(parent, selector) {
7
- this.parentElementAccessor = parent instanceof PageElement ? () => parent.element() : parent;
8
- this.elementAccessStrategy = _.isString(selector) ? {
9
- findIn: p => p.find(selector),
10
- shouldNotExist: (p) => p.should('not.have', selector)
11
- } : selector;
24
+ constructor(parent, selectorOrLocator) {
25
+ this.parent = parent;
26
+ const selector = selectorOrLocator !== null && selectorOrLocator !== void 0 ? selectorOrLocator : this.getDefaultSelector();
27
+ this.domElementLocator = _.isString(selector) ?
28
+ ElementLocator.findByCssSelector(selector) :
29
+ selector;
12
30
  }
13
- element() {
14
- const parent = this.getParentElement();
15
- return parent ? this.elementAccessStrategy.findIn(parent) : undefined;
31
+ getDefaultSelector() {
32
+ return Stringy.from(this.constructor.name).dasherize().toString();
16
33
  }
17
- getParentElement() {
18
- return this.parentElementAccessor ? this.parentElementAccessor() : undefined;
34
+ dom() {
35
+ return this.domElementLocator(this.parent);
19
36
  }
20
37
  find(selector) {
21
- return new PageElement(() => this.element(), selector);
38
+ return new PageElement(this, selector);
22
39
  }
23
40
  click(text) {
24
- text ? this.element().contains(text).click() : this.element().click();
41
+ text ? this.dom().contains(text).click() : this.dom().click();
25
42
  }
26
43
  get should() {
27
44
  return this.getShoulder(this.getShouldElement());
@@ -30,113 +47,47 @@ class PageElement {
30
47
  return element.should.bind(element);
31
48
  }
32
49
  getShouldElement() {
33
- return this.element();
50
+ return this.dom();
34
51
  }
35
52
  shouldBeVisible() {
36
53
  this.should('be.visible');
37
54
  }
38
55
  shouldNotBeVisible() {
39
- if (!this.elementAccessStrategy.shouldNotExist) {
40
- lang.abstractMethod(this.constructor);
41
- }
42
- this.elementAccessStrategy.shouldNotExist(this.getParentElement());
56
+ this.should('not.be.visible');
43
57
  }
44
- }
45
-
46
- let urlSerialiser = new DefaultUrlSerializer();
47
- class Path {
48
- constructor(segments) {
49
- this.segments = segments;
58
+ shouldExist() {
59
+ this.dom().should('exist');
50
60
  }
51
- static extractVisitParameters(url) {
52
- let result = {};
53
- const urlTree = urlSerialiser.parse(url);
54
- urlTree.root.children.primary.segments.forEach(s => {
55
- result = Object.assign(Object.assign({}, result), s.parameters);
56
- });
57
- return result;
58
- }
59
- toUrl(matrixParams) {
60
- return this.segments.map(s => s.toUrlPart(matrixParams)).join('/');
61
+ shouldNotExist() {
62
+ this.dom().should('not.exist');
61
63
  }
62
64
  }
63
- (function (Path) {
64
- function setUrlSerialiser(serialiser) {
65
- urlSerialiser = serialiser;
66
- }
67
- Path.setUrlSerialiser = setUrlSerialiser;
68
- class Segment {
69
- constructor(path, params = {}) {
70
- var _a;
71
- this.path = path;
72
- this.routeId = params === null || params === void 0 ? void 0 : params.routeId;
73
- this.visitParams = (_a = params === null || params === void 0 ? void 0 : params.visitParams) !== null && _a !== void 0 ? _a : [];
74
- }
75
- toUrlPart(params) {
76
- let path = this.path;
77
- this.visitParams.forEach(p => {
78
- const value = params[p];
79
- if (value) {
80
- path = `${path};${p}=${value}`;
81
- }
82
- });
83
- if (this.routeId && params[this.routeId]) {
84
- path = path + '/' + params[this.routeId];
85
- }
86
- return path;
87
- }
88
- }
89
- Path.Segment = Segment;
90
- class Builder {
91
- constructor() {
92
- this.segments = [];
93
- }
94
- segment(name, params) {
95
- const builder = new Segment(name, params);
96
- this.segments.push(builder);
97
- return this;
98
- }
99
- getPath() {
100
- return new Path(this.segments);
101
- }
102
- }
103
- Path.Builder = Builder;
104
- })(Path || (Path = {}));
105
65
 
106
- class FaceAccessor {
107
- constructor(face) {
108
- this.face = face;
109
- }
110
- findIn(parent) {
111
- return this.face.text ?
112
- parent.contains(`aup-command-face`, this.face.text()) :
113
- this.face.icon ?
114
- parent.find(`aup-icon[ng-reflect-icon=${this.face.icon()}]`).closest('aup-command-face') :
115
- undefined;
116
- }
117
- shouldNotExist(parent) {
118
- return this.face.text ?
119
- parent.should('not.contain', `aup-command-face`, this.face.text()) :
120
- this.face.icon ?
121
- parent.should('not.contain', `aup-icon[ng-reflect-icon=${this.face.icon()}]`) :
122
- undefined;
123
- }
124
- }
125
66
  class AupCommandFace extends PageElement {
126
67
  constructor(parentElement, face) {
127
- super(() => parentElement.element(), AupCommandFace.createAccessor(face));
128
- }
129
- static createAccessor(face) {
130
- return new FaceAccessor(face);
68
+ super(parentElement, AupCommandFace.createElementLocator(face));
69
+ }
70
+ static createElementLocator(face) {
71
+ const locator = parent => {
72
+ return face.text ?
73
+ parent.dom().contains(`aup-command-face`, face.text()) :
74
+ face.icon ?
75
+ parent.dom().find(`aup-icon[ng-reflect-icon=${face.icon()}]`).closest('aup-command-face') :
76
+ undefined;
77
+ };
78
+ // aot compiler doesn't like lambas
79
+ return locator;
131
80
  }
132
81
  }
133
82
 
134
83
  class AupCommand extends PageElement {
135
- constructor(parent, face) {
136
- const faceAccessor = AupCommandFace.createAccessor(face);
137
- super(parent, {
138
- findIn(parentElement) {
139
- return faceAccessor.findIn(parentElement).closest('aup-command');
84
+ constructor(parent, faceOrSelector) {
85
+ super(parent, parentElement => {
86
+ if (_.isString(faceOrSelector)) {
87
+ return parentElement.dom().find(faceOrSelector);
88
+ }
89
+ else {
90
+ return AupCommandFace.createElementLocator(faceOrSelector)(parentElement).closest('aup-command');
140
91
  }
141
92
  });
142
93
  }
@@ -150,19 +101,25 @@ class AupCommand extends PageElement {
150
101
  this.getButton().should('be.disabled');
151
102
  }
152
103
  getButton() {
153
- return this.element().find('button');
104
+ return this.dom().find('button');
105
+ }
106
+ }
107
+
108
+ class AupEmptyState extends PageElement {
109
+ shouldContainText(text) {
110
+ this.dom().should("contain.text", text);
154
111
  }
155
112
  }
156
113
 
157
114
  class AupInput extends PageElement {
158
115
  label() {
159
- return this.element().find('label');
116
+ return this.dom().find('label');
160
117
  }
161
118
  hint() {
162
- return this.element().find('mat-hint');
119
+ return this.dom().find('mat-hint');
163
120
  }
164
121
  error() {
165
- return this.element().find('mat-error');
122
+ return this.dom().find('mat-error');
166
123
  }
167
124
  get labelShould() {
168
125
  return this.getShoulder(this.label());
@@ -182,11 +139,23 @@ class AupInput extends PageElement {
182
139
  errorShouldBe(text) {
183
140
  return this.errorShould("have.text", text);
184
141
  }
142
+ shouldBeFocused() {
143
+ this.input().should("have.focus");
144
+ }
145
+ shouldNotBeFocused() {
146
+ this.input().should("not.have.focus");
147
+ }
148
+ type(characters) {
149
+ this.input().type(characters);
150
+ }
151
+ hitEnter() {
152
+ this.type("{enter}");
153
+ }
185
154
  }
186
155
  (function (AupInput) {
187
156
  class HtmlInput extends AupInput {
188
157
  input() {
189
- return this.element().find('input');
158
+ return this.dom().find('input');
190
159
  }
191
160
  clear() {
192
161
  this.input().clear();
@@ -207,7 +176,7 @@ class AupInput extends PageElement {
207
176
  return this.input();
208
177
  }
209
178
  input() {
210
- return this.element().find('textarea');
179
+ return this.dom().find('textarea');
211
180
  }
212
181
  clear() {
213
182
  this.input().clear();
@@ -222,6 +191,46 @@ class AupInput extends PageElement {
222
191
  AupInput.TextAreaInput = TextAreaInput;
223
192
  })(AupInput || (AupInput = {}));
224
193
 
194
+ class AupPopupMenuPanel extends PageElement {
195
+ }
196
+
197
+ class AupAbstractPopupMenu extends PageElement {
198
+ constructor(parent, locator) {
199
+ super(parent, locator);
200
+ this.popup = new AupPopupMenuPanel(this, p => this.findPopupIn(p));
201
+ }
202
+ findPopupIn(p) {
203
+ return this.getOverlay().find('.mat-menu-panel');
204
+ }
205
+ getOverlay() {
206
+ return this.dom().closest('body').find('.cdk-overlay-container');
207
+ }
208
+ getBackdrop() {
209
+ return this.getOverlay().find('.cdk-overlay-backdrop');
210
+ }
211
+ openPopup() {
212
+ this.shouldNotBeOpen();
213
+ this.click();
214
+ return this.popup;
215
+ }
216
+ closePopup() {
217
+ this.shouldBeOpen();
218
+ this.getBackdrop().click();
219
+ }
220
+ shouldBeOpen() {
221
+ this.popup.shouldBeVisible();
222
+ }
223
+ shouldNotBeOpen() {
224
+ this.dom().closest('body').find('.mat-menu-panel').should("not.exist");
225
+ }
226
+ }
227
+
228
+ class AupMoreMenu extends AupAbstractPopupMenu {
229
+ static create(parent, selector) {
230
+ return new AupMoreMenu(parent, ElementLocator.findByCssSelector(selector !== null && selector !== void 0 ? selector : 'aup-more-menu'));
231
+ }
232
+ }
233
+
225
234
  class AupNavigation extends PageElement {
226
235
  click(label) {
227
236
  return super.click(label);
@@ -233,123 +242,385 @@ class AupNavigation extends PageElement {
233
242
  this.face(label).shouldBeVisible();
234
243
  }
235
244
  shouldNotHaveLink(label) {
236
- this.face(label).shouldNotBeVisible();
245
+ this.face(label).shouldNotExist();
246
+ }
247
+ }
248
+
249
+ class AupTableCell extends PageElement {
250
+ rowId() {
251
+ return this.dom().closest('tr').invoke('attr', 'aup-row-id');
252
+ }
253
+ row() {
254
+ const self = this;
255
+ return this.parent.createRow(parent => {
256
+ return self.rowId().then(rowId => parent.dom().find(AupAbstractTable.cssSelectorForTableRowById(rowId)));
257
+ });
258
+ }
259
+ }
260
+
261
+ class AupTableColumn extends PageElement {
262
+ constructor(table, columnId) {
263
+ super(table, AupAbstractTable.cssSelectorForColumnCellRendererById(columnId));
264
+ this.columnId = columnId;
265
+ }
266
+ cellContaining(content) {
267
+ const self = this;
268
+ return new AupTableCell(this.parent, parent => {
269
+ return parent.dom().contains(AupAbstractTable.cssSelectorForColumnCellRendererById(self.columnId), content);
270
+ });
271
+ }
272
+ rowContaining(content) {
273
+ return this.cellContaining(content).row();
237
274
  }
238
275
  }
239
276
 
240
- class AupTable extends PageElement {
241
- constructor(parentElementAccessor, selector) {
242
- super(parentElementAccessor, selector);
277
+ class AupTableSelectionColumn extends AupTableColumn {
278
+ selectAll() {
243
279
  }
280
+ }
281
+
282
+ class AupAbstractTable extends PageElement {
244
283
  row(rowId) {
245
- return new AupTable.Row(() => this.element(), `tr[aup-table-id=${rowId}]`);
284
+ return this.createRow(parent => {
285
+ return parent.dom().find(AupAbstractTable.cssSelectorForTableRowById(rowId));
286
+ });
287
+ }
288
+ rowNumber(rowNumber) {
289
+ return this.createRow(parent => {
290
+ return parent.dom().find(AupAbstractTable.cssSelectorForNthTableRow(rowNumber));
291
+ });
246
292
  }
247
293
  column(columnId) {
248
- return new AupTable.Column(this, columnId);
294
+ return new AupTableColumn(this, columnId);
295
+ }
296
+ get selectionColumn() {
297
+ return new AupTableSelectionColumn(this, 'selection-column');
249
298
  }
250
299
  }
251
- (function (AupTable) {
252
- class Row extends PageElement {
300
+ __decorate([
301
+ Memoize(),
302
+ __metadata("design:type", AupTableSelectionColumn),
303
+ __metadata("design:paramtypes", [])
304
+ ], AupAbstractTable.prototype, "selectionColumn", null);
305
+ (function (AupAbstractTable) {
306
+ function cssSelectorForTableRowById(rowId) {
307
+ return `tbody tr[aup-row-id=${rowId}]`;
308
+ }
309
+ AupAbstractTable.cssSelectorForTableRowById = cssSelectorForTableRowById;
310
+ function cssSelectorForNthTableRow(rowNumber) {
311
+ return `tbody tr:nth-child(${rowNumber})`;
312
+ }
313
+ AupAbstractTable.cssSelectorForNthTableRow = cssSelectorForNthTableRow;
314
+ function cssSelectorForColumnCellRendererById(columnOrId) {
315
+ const columnId = _.isString(columnOrId) ? columnOrId : columnOrId.columnId;
316
+ return `aup-table-cell-renderer[column-id=${columnId}]`;
317
+ }
318
+ AupAbstractTable.cssSelectorForColumnCellRendererById = cssSelectorForColumnCellRendererById;
319
+ function cssSelectorForCell(rowId, columnOrId) {
320
+ return `${cssSelectorForTableRowById(rowId)} ${cssSelectorForColumnCellRendererById(columnOrId)}`;
321
+ }
322
+ AupAbstractTable.cssSelectorForCell = cssSelectorForCell;
323
+ })(AupAbstractTable || (AupAbstractTable = {}));
324
+
325
+ /* tslint:disable:unified-signatures */
326
+ class AupTableRow extends PageElement {
327
+ rowId() {
328
+ return this.dom()
329
+ .invoke('attr', 'aup-row-id');
330
+ }
331
+ shouldHaveRowId(rowId) {
332
+ this.rowId().should('eq', rowId);
333
+ }
334
+ cell(columnOrId) {
335
+ const self = this;
336
+ return new AupTableCell(this.parent, parent => {
337
+ return self.rowId()
338
+ .then(rowId => AupAbstractTable.cssSelectorForCell(rowId, columnOrId))
339
+ .then(selector => parent.dom().find(selector));
340
+ });
341
+ }
342
+ shouldBeSelected() {
343
+ this.dom().should('have.class', 'aup-row-selected');
344
+ }
345
+ shouldNotBeSelected() {
346
+ this.dom().should('not.have.class', 'aup-row-selected');
347
+ }
348
+ }
349
+
350
+ class AupTable extends AupAbstractTable {
351
+ createRow(locator) {
352
+ return new AupTableRow(this, locator);
253
353
  }
254
- AupTable.Row = Row;
255
- class Column {
256
- constructor(table, columnId) {
257
- this.table = table;
258
- this.columnId = columnId;
354
+ }
355
+
356
+ class AupTreeTable extends AupAbstractTable {
357
+ get treeControlColumn() {
358
+ return new AupTreeTable.TreeControlColumn(this, 'tree-label');
359
+ }
360
+ createRow(locator) {
361
+ return new AupTreeTable.Row(this, locator);
362
+ }
363
+ }
364
+ __decorate([
365
+ Memoize(),
366
+ __metadata("design:type", AupTreeTable.TreeControlColumn),
367
+ __metadata("design:paramtypes", [])
368
+ ], AupTreeTable.prototype, "treeControlColumn", null);
369
+ (function (AupTreeTable) {
370
+ class Row extends AupTableRow {
371
+ shouldBeExpanded() {
372
+ this.dom().should("not.have.class", "aup-node-collapsed");
259
373
  }
260
- cell(content) {
261
- const self = this;
262
- return new Cell(this.table, {
263
- findIn(parent) {
264
- return parent.contains(`aup-table-cell-renderer[column-id=${self.columnId}]`, content);
265
- }
266
- });
374
+ shouldBeCollapsed() {
375
+ this.dom().should("have.class", "aup-node-collapsed");
267
376
  }
268
377
  }
269
- AupTable.Column = Column;
270
- class Cell extends PageElement {
378
+ AupTreeTable.Row = Row;
379
+ class TreeControlColumn extends AupTableColumn {
271
380
  }
272
- AupTable.Cell = Cell;
273
- })(AupTable || (AupTable = {}));
381
+ AupTreeTable.TreeControlColumn = TreeControlColumn;
382
+ })(AupTreeTable || (AupTreeTable = {}));
274
383
 
275
- function ButtonMixin(Base) {
384
+ function FormElementMixin(Base) {
276
385
  return class extends Base {
277
386
  constructor(...args) {
278
387
  super(...args);
279
388
  }
280
- click() {
281
- return this.element().click();
282
- }
283
389
  shouldBeDisabled() {
284
390
  this.should("be.disabled");
285
- // this.should("have.css", "color", "rgba(0,0,0,0.26)")
286
391
  }
287
392
  };
288
393
  }
289
394
 
290
- class Button extends ButtonMixin(PageElement) {
395
+ class Button extends FormElementMixin(PageElement) {
291
396
  constructor(parentElementAccessor, buttonText) {
292
- super(parentElementAccessor, {
293
- findIn(parent) {
294
- return parent.contains('button', buttonText);
295
- },
296
- shouldNotExist(parent) {
297
- return parent.should('not.contain', buttonText);
298
- }
299
- });
397
+ super(parentElementAccessor, ElementLocator.findBySelectorAndTextContent('button', buttonText));
300
398
  }
301
399
  }
302
400
 
303
- var Section;
304
- (function (Section) {
305
- function Mixin$1(Base) {
306
- return class extends Base {
307
- section(selector, section) {
308
- const impl = new Impl(() => this.element(), selector);
309
- return Mixin.createProxy(section(impl), impl);
310
- }
311
- find(selector) {
312
- return new PageElement(() => this.element(), selector);
313
- }
314
- contains(text) {
315
- return new PageElement(() => this.element(), {
316
- findIn: parent => parent.contains(text),
317
- shouldNotExist: (parent) => parent.should('not.contain', text)
318
- });
319
- }
320
- button(text) {
321
- return new Button(() => this.element(), text);
322
- }
323
- aupStringInput(selector) {
324
- return new AupInput.HtmlInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-string-input');
325
- }
326
- aupTextInput(selector) {
327
- return new AupInput.TextAreaInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-text-input');
328
- }
329
- aupPasswordInput(selector) {
330
- return new AupInput.HtmlInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-password-input');
331
- }
332
- aupNumberInput(selector) {
333
- return new AupInput.HtmlInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-number-input');
334
- }
335
- aupCommand(face) {
336
- return new AupCommand(this, face);
337
- }
338
- aupTabbedNavigation() {
339
- return new AupNavigation(this, 'aup-tabbed-place-navigation');
401
+ class MatCheckbox extends FormElementMixin(PageElement) {
402
+ constructor(parentElementAccessor, text) {
403
+ super(parentElementAccessor, ElementLocator.findBySelectorAndTextContent('mat-checkbox', text));
404
+ }
405
+ shouldBeChecked() {
406
+ this.hiddenCheckBoxElement().should('be.checked');
407
+ }
408
+ shouldNotBeChecked() {
409
+ this.hiddenCheckBoxElement().should('not.be.checked');
410
+ }
411
+ hiddenCheckBoxElement() {
412
+ return this.dom().find('input[type=checkbox]');
413
+ }
414
+ check() {
415
+ this.hiddenCheckBoxElement().then(el => {
416
+ if (!el.prop('checked')) {
417
+ this.click();
418
+ this.shouldBeChecked();
340
419
  }
341
- aupSideNavigation() {
342
- return new AupNavigation(() => this.element(), 'aup-list-place-nav');
420
+ });
421
+ }
422
+ uncheck() {
423
+ this.hiddenCheckBoxElement().then(el => {
424
+ if (el.prop('checked')) {
425
+ this.click();
426
+ this.shouldNotBeChecked();
343
427
  }
344
- aupTable(selector) {
345
- return new AupTable(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-table');
428
+ });
429
+ }
430
+ }
431
+
432
+ class Builder {
433
+ constructor(parentPageElement) {
434
+ this.parentPageElement = parentPageElement;
435
+ }
436
+ find(selector) {
437
+ return new PageElement(this.parentPageElement, selector);
438
+ }
439
+ section(selector, builder) {
440
+ return this.component(PageElement, selector, builder);
441
+ }
442
+ contains(text) {
443
+ return new PageElement(this.parentPageElement, ElementLocator.findByTextContent(text));
444
+ }
445
+ button(text) {
446
+ return new Button(this.parentPageElement, text);
447
+ }
448
+ matCheckbox(text) {
449
+ return new MatCheckbox(this.parentPageElement, text);
450
+ }
451
+ aupStringInput(selector) {
452
+ return new AupInput.HtmlInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-string-input');
453
+ }
454
+ aupTextInput(selector) {
455
+ return new AupInput.TextAreaInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-text-input');
456
+ }
457
+ aupPasswordInput(selector) {
458
+ return new AupInput.HtmlInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-password-input');
459
+ }
460
+ aupNumberInput(selector) {
461
+ return new AupInput.HtmlInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-number-input');
462
+ }
463
+ aupCommand(faceOrSelector) {
464
+ return new AupCommand(this.parentPageElement, faceOrSelector);
465
+ }
466
+ aupTabbedNavigation() {
467
+ return new AupNavigation(this.parentPageElement, 'aup-tabbed-place-navigation');
468
+ }
469
+ aupSideNavigation() {
470
+ return new AupNavigation(this.parentPageElement, 'aup-list-place-nav');
471
+ }
472
+ aupMoreMenu(selector) {
473
+ return AupMoreMenu.create(this.parentPageElement, selector);
474
+ }
475
+ aupTable(selectorOrBuilder, optionalBuilder) {
476
+ return this.component(AupTable, selectorOrBuilder, optionalBuilder);
477
+ }
478
+ aupTreeTable(selectorOrBuilder, optionalBuilder) {
479
+ return this.component(AupTreeTable, selectorOrBuilder, optionalBuilder);
480
+ }
481
+ aupEmptyState(selectorOrBuilder, optionalBuilder) {
482
+ return this.component(AupEmptyState, selectorOrBuilder, optionalBuilder);
483
+ }
484
+ component(klass, selectorOrBuilder, optionalBuilder) {
485
+ const selector = _.isString(selectorOrBuilder) ? selectorOrBuilder : undefined;
486
+ const builder = _.isFunction(selectorOrBuilder) ? selectorOrBuilder : optionalBuilder;
487
+ const element = new klass(this.parentPageElement, selector);
488
+ if (builder) {
489
+ // create the B&E type that the builder has access to
490
+ const decoratedElement = Mixin.createProxy(element, new Builder(element));
491
+ // create final type that has the E & T type
492
+ return Mixin.createProxy(decoratedElement, builder(decoratedElement));
493
+ }
494
+ else {
495
+ return element;
496
+ }
497
+ }
498
+ }
499
+
500
+ class AupAbstractActivity extends PageElement {
501
+ constructor(parent, selector) {
502
+ // @ts-ignore
503
+ super(parent, selector);
504
+ this.title = this.find('aup-activity-title');
505
+ this._confirmCommand = new Builder(this).aupCommand('[data-cy=confirm-command]');
506
+ this._cancelCommand = new Builder(this).aupCommand('[data-cy=cancel-command]');
507
+ }
508
+ }
509
+
510
+ class AupAlert extends AupAbstractActivity {
511
+ constructor(parent, selector) {
512
+ super(parent, selector);
513
+ }
514
+ get closeCommand() {
515
+ return this._confirmCommand;
516
+ }
517
+ clickClose() {
518
+ this.closeCommand.click();
519
+ }
520
+ }
521
+
522
+ class AupAlertDialog extends AupAlert {
523
+ constructor(parent, selector) {
524
+ super(parent, selector);
525
+ }
526
+ clickBackdrop() {
527
+ this.dom()
528
+ .closest(`.cdk-overlay-container`)
529
+ .find(`.cdk-overlay-backdrop`).click(-50, -50, { force: true });
530
+ }
531
+ }
532
+
533
+ class AupActivity extends AupAbstractActivity {
534
+ constructor(parent, selector) {
535
+ super(parent, selector);
536
+ }
537
+ get confirmCommand() {
538
+ return this._confirmCommand;
539
+ }
540
+ get cancelCommand() {
541
+ return this._cancelCommand;
542
+ }
543
+ }
544
+
545
+ class AupModalActivity extends AupActivity {
546
+ clickBackdrop() {
547
+ this.dom().closest(`.cdk-overlay-backdrop`).click(-50, -50, { force: true });
548
+ }
549
+ }
550
+
551
+ class PageBuilder extends Builder {
552
+ aupModalActivity(selector, builder) {
553
+ return this.component(AupModalActivity, `.dialog-interaction-context ${selector}`, builder);
554
+ }
555
+ aupModalAlert(builder) {
556
+ return this.component(AupAlertDialog, `.dialog-interaction-context aup-alert-dialog`, builder);
557
+ }
558
+ aupModelConfirm(builder) {
559
+ return this.aupModalActivity(`aup-confirm-dialog`, builder);
560
+ }
561
+ }
562
+
563
+ let urlSerialiser = new DefaultUrlSerializer();
564
+ class Path {
565
+ constructor(segments) {
566
+ this.segments = segments;
567
+ }
568
+ static extractVisitParameters(url) {
569
+ var _a, _b;
570
+ let result = {};
571
+ const urlTree = urlSerialiser.parse(url);
572
+ const urlSegments = (_b = (_a = urlTree.root.children.primary) === null || _a === void 0 ? void 0 : _a.segments) !== null && _b !== void 0 ? _b : [];
573
+ urlSegments === null || urlSegments === void 0 ? void 0 : urlSegments.forEach(s => {
574
+ result = Object.assign(Object.assign({}, result), s.parameters);
575
+ });
576
+ return result;
577
+ }
578
+ toUrl(matrixParams) {
579
+ return this.segments.map(s => s.toUrlPart(matrixParams)).join('/');
580
+ }
581
+ }
582
+ (function (Path) {
583
+ function setUrlSerialiser(serialiser) {
584
+ urlSerialiser = serialiser;
585
+ }
586
+ Path.setUrlSerialiser = setUrlSerialiser;
587
+ class Segment {
588
+ constructor(path, params = {}) {
589
+ var _a;
590
+ this.path = path;
591
+ this.routeId = params === null || params === void 0 ? void 0 : params.routeId;
592
+ this.visitParams = (_a = params === null || params === void 0 ? void 0 : params.visitParams) !== null && _a !== void 0 ? _a : [];
593
+ }
594
+ toUrlPart(params) {
595
+ let path = this.path;
596
+ this.visitParams.forEach(p => {
597
+ const value = params[p];
598
+ if (value) {
599
+ path = `${path};${p}=${value}`;
600
+ }
601
+ });
602
+ if (this.routeId && params[this.routeId]) {
603
+ path = path + '/' + params[this.routeId];
346
604
  }
347
- };
605
+ return path;
606
+ }
348
607
  }
349
- Section.Mixin = Mixin$1;
350
- class Impl extends Mixin$1(PageElement) {
608
+ Path.Segment = Segment;
609
+ class Builder {
610
+ constructor() {
611
+ this.segments = [];
612
+ }
613
+ segment(name, params) {
614
+ const builder = new Segment(name, params);
615
+ this.segments.push(builder);
616
+ return this;
617
+ }
618
+ getPath() {
619
+ return new Path(this.segments);
620
+ }
351
621
  }
352
- })(Section || (Section = {}));
622
+ Path.Builder = Builder;
623
+ })(Path || (Path = {}));
353
624
 
354
625
  class Page extends PageElement {
355
626
  constructor(path) {
@@ -357,7 +628,7 @@ class Page extends PageElement {
357
628
  this.path = path;
358
629
  this.rootElementSelector = 'body';
359
630
  }
360
- element() {
631
+ dom() {
361
632
  return cy.get(this.rootElementSelector);
362
633
  }
363
634
  visit(visitParams, queryParams) {
@@ -380,7 +651,7 @@ class Page extends PageElement {
380
651
  }
381
652
  shouldBeActive(withParameters) {
382
653
  // Note: cy.window() doesn't return a promise... it's a chainable.
383
- cy["waitUntil"](() => {
654
+ cy['waitUntil'](() => {
384
655
  return cy.window().then(window => {
385
656
  return window['aup.PlaceRouter'] && !window['aup.PlaceRouter'].isNavigating();
386
657
  });
@@ -398,53 +669,43 @@ class Page extends PageElement {
398
669
  }
399
670
  }
400
671
  (function (Page) {
401
- function create(pathOrPathBuilder, page) {
672
+ function create(pathOrPathBuilder, builder) {
402
673
  const pathBuilder = new Path.Builder();
403
674
  if (_.isString(pathOrPathBuilder)) {
404
- pathOrPathBuilder.split("/").filter(p => !_.isEmpty(p)).forEach(p => pathBuilder.segment(p));
675
+ pathOrPathBuilder.split('/').filter(p => !_.isEmpty(p)).forEach(p => pathBuilder.segment(p));
405
676
  }
406
677
  else {
407
678
  pathOrPathBuilder(pathBuilder);
408
679
  }
409
- const builder = new PageBuilder(pathBuilder.getPath());
410
- return Mixin.createProxy(page(builder), builder);
680
+ const instance = new Page(pathBuilder.getPath());
681
+ const content = builder.call(instance, new PageBuilder(instance));
682
+ return Mixin.createProxy(content, instance);
411
683
  }
412
684
  Page.create = create;
413
- class PageBuilder extends Section.Mixin(Page) {
414
- }
415
- Page.PageBuilder = PageBuilder;
416
685
  })(Page || (Page = {}));
417
686
 
418
687
  class AupCommandGroup extends PageElement {
419
688
  }
420
689
 
421
- class AupMoreMenu extends PageElement {
422
- static create(parent) {
423
- return new AupMoreMenu(parent, 'aup-more-menu');
690
+ class AupToolBar extends PageElement {
691
+ static create(parent, face) {
692
+ // const findFace = AupCommandFace.createFinder(() => parent.element(), face)
693
+ // return new AupCommandGroup(() => findFace().closest('button'));
424
694
  }
425
695
  }
426
696
 
427
- class AupPopupMenu extends PageElement {
697
+ class AupPopupMenu extends AupAbstractPopupMenu {
428
698
  constructor(parentElementAccessor, face) {
429
- const accessor = AupCommandFace.createAccessor(face);
430
- super(parentElementAccessor, {
431
- findIn(parent) {
432
- return accessor.findIn(parent).closest('button');
433
- },
434
- shouldNotExist(parent) {
435
- accessor.shouldNotExist(parent);
436
- }
437
- });
699
+ const locator = AupCommandFace.createElementLocator(face);
700
+ super(parentElementAccessor, parent => locator(parent).closest('button'));
438
701
  }
439
702
  static create(parent, face) {
440
703
  return new AupPopupMenu(parent, face);
441
704
  }
442
705
  }
443
706
 
444
- class AupToolBar extends PageElement {
445
- static create(parent, face) {
446
- // const findFace = AupCommandFace.createFinder(() => parent.element(), face)
447
- // return new AupCommandGroup(() => findFace().closest('button'));
707
+ class AupTableSelectionCell extends AupTableCell {
708
+ selectAll() {
448
709
  }
449
710
  }
450
711
 
@@ -456,5 +717,5 @@ class AupToolBar extends PageElement {
456
717
  * Generated bundle index. Do not edit.
457
718
  */
458
719
 
459
- export { AupCommand, AupCommandFace, AupCommandGroup, AupInput, AupMoreMenu, AupNavigation, AupPopupMenu, AupTable, AupToolBar, Button, ButtonMixin, FaceAccessor, Page, PageElement, Path, Section };
720
+ export { AupAbstractActivity, AupAbstractPopupMenu, AupAbstractTable, AupActivity, AupAlert, AupAlertDialog, AupCommand, AupCommandFace, AupCommandGroup, AupEmptyState, AupInput, AupModalActivity, AupMoreMenu, AupNavigation, AupPopupMenu, AupPopupMenuPanel, AupTable, AupTableCell, AupTableColumn, AupTableRow, AupTableSelectionCell, AupTableSelectionColumn, AupToolBar, AupTreeTable, Builder, Button, ElementLocator, FormElementMixin, MatCheckbox, Page, PageBuilder, PageElement, Path };
460
721
  //# sourceMappingURL=coolon-angular-ui-powerups-cypress.js.map