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

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