@brightspace-ui/testing 1.31.6 → 1.32.0
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.
- package/README.md +0 -2
- package/package.json +1 -7
- package/src/server/report/app.js +61 -30
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# @brightspace-ui/testing
|
|
2
2
|
|
|
3
|
-
Note: This version is testing out the new semantic-release beta.
|
|
4
|
-
|
|
5
3
|
[](https://www.npmjs.org/package/@brightspace-ui/testing)
|
|
6
4
|
|
|
7
5
|
Testing utilities which are specifically designed and configured for Brightspace UI components and applications.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@brightspace-ui/testing",
|
|
3
3
|
"description": "Utilities for testing front-end components and applications",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.32.0",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/testing.git",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "npm run lint:eslint && npm run lint:style",
|
|
@@ -55,14 +55,8 @@
|
|
|
55
55
|
"d2l-test-reporting": "^4",
|
|
56
56
|
"glob": "^11",
|
|
57
57
|
"lit": "^2 || ^3",
|
|
58
|
-
"page": "^1",
|
|
59
58
|
"pixelmatch": "^7",
|
|
60
59
|
"pngjs": "^7",
|
|
61
60
|
"rollup": "^4"
|
|
62
|
-
},
|
|
63
|
-
"overrides": {
|
|
64
|
-
"page": {
|
|
65
|
-
"path-to-regexp": "^1.9.0"
|
|
66
|
-
}
|
|
67
61
|
}
|
|
68
62
|
}
|
package/src/server/report/app.js
CHANGED
|
@@ -6,7 +6,6 @@ import { RADIO_STYLE, renderRadio } from './radio.js';
|
|
|
6
6
|
import { renderBrowserResults, RESULT_STYLE } from './result.js';
|
|
7
7
|
import { renderTabButtons, renderTabPanel, TAB_STYLE } from './tabs.js';
|
|
8
8
|
import data from './data.js';
|
|
9
|
-
import page from 'page';
|
|
10
9
|
|
|
11
10
|
class App extends LitElement {
|
|
12
11
|
static properties = {
|
|
@@ -124,6 +123,7 @@ class App extends LitElement {
|
|
|
124
123
|
`];
|
|
125
124
|
constructor() {
|
|
126
125
|
super();
|
|
126
|
+
this._files = [];
|
|
127
127
|
this._filterBrowsers = data.browsers.map(b => b.name);
|
|
128
128
|
this._filterHideByteDiff = false;
|
|
129
129
|
this._filterStatus = data.numFailed > 0 ? FILTER_STATUS.FAILED : FILTER_STATUS.ALL;
|
|
@@ -132,37 +132,18 @@ class App extends LitElement {
|
|
|
132
132
|
this._overlay = true;
|
|
133
133
|
this._selectedBrowserIndex = -1;
|
|
134
134
|
}
|
|
135
|
+
|
|
135
136
|
connectedCallback() {
|
|
136
137
|
super.connectedCallback();
|
|
138
|
+
window.addEventListener('click', this.#handleClickBound);
|
|
139
|
+
window.addEventListener('popstate', this.#handleLocationChangeBound);
|
|
140
|
+
this.#handleLocationChangeBound();
|
|
137
141
|
this._root = new URL(window.location.href).pathname;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this._filterTest = searchParams.get('test');
|
|
144
|
-
} else {
|
|
145
|
-
this._filterTest = undefined;
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
this._filterFile = undefined;
|
|
149
|
-
this._filterTest = undefined;
|
|
150
|
-
this._selectedBrowserIndex = -1;
|
|
151
|
-
}
|
|
152
|
-
if (searchParams.has('status')) {
|
|
153
|
-
let filterStatus = searchParams.get('status');
|
|
154
|
-
if (filterStatus === FILTER_STATUS.FAILED && data.numFailed === 0) {
|
|
155
|
-
filterStatus = FILTER_STATUS.ALL;
|
|
156
|
-
}
|
|
157
|
-
this._filterStatus = filterStatus;
|
|
158
|
-
}
|
|
159
|
-
if (searchParams.has('browsers')) {
|
|
160
|
-
this._filterBrowsers = searchParams.get('browsers').split(',');
|
|
161
|
-
}
|
|
162
|
-
this._filterHideByteDiff = searchParams.has('bytediff');
|
|
163
|
-
this._updateFiles();
|
|
164
|
-
});
|
|
165
|
-
page();
|
|
142
|
+
}
|
|
143
|
+
disconnectedCallback() {
|
|
144
|
+
super.disconnectedCallback();
|
|
145
|
+
window.removeEventListener('click', this.#handleClickBound);
|
|
146
|
+
window.removeEventListener('popstate', this.#handleLocationChangeBound);
|
|
166
147
|
}
|
|
167
148
|
render() {
|
|
168
149
|
return html`
|
|
@@ -175,6 +156,10 @@ class App extends LitElement {
|
|
|
175
156
|
<main>${this._renderMainView()}</main>
|
|
176
157
|
`;
|
|
177
158
|
}
|
|
159
|
+
|
|
160
|
+
#handleClickBound = this.#handleClick.bind(this);
|
|
161
|
+
#handleLocationChangeBound = this.#handleLocationChange.bind(this);
|
|
162
|
+
|
|
178
163
|
_handleFilterBrowserChange(e) {
|
|
179
164
|
const browsers = data.browsers.map(b => b.name).filter(b => {
|
|
180
165
|
if (b === e.target.value) {
|
|
@@ -522,7 +507,53 @@ class App extends LitElement {
|
|
|
522
507
|
searchParams.set(name, params[name]);
|
|
523
508
|
}
|
|
524
509
|
}
|
|
525
|
-
|
|
510
|
+
this.#navigate(`${this._root}?${searchParams.toString()}`);
|
|
511
|
+
}
|
|
512
|
+
#handleClick(e) {
|
|
513
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.defaultPrevented) return;
|
|
514
|
+
|
|
515
|
+
let el;
|
|
516
|
+
const eventPath = e.composedPath();
|
|
517
|
+
for (let i = 0; i < eventPath.length; i++) {
|
|
518
|
+
if (eventPath[i].nodeName?.toUpperCase() !== 'A' || !eventPath[i]?.href) continue;
|
|
519
|
+
el = eventPath[i];
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
if (!el) return;
|
|
523
|
+
|
|
524
|
+
e.preventDefault();
|
|
525
|
+
this.#navigate(`${el.pathname}${el.search}`);
|
|
526
|
+
}
|
|
527
|
+
#handleLocationChange() {
|
|
528
|
+
const searchParams = new URLSearchParams(new URL(window.location.href).search);
|
|
529
|
+
if (searchParams.has('file')) {
|
|
530
|
+
this._filterFile = searchParams.get('file');
|
|
531
|
+
if (searchParams.has('test')) {
|
|
532
|
+
this._filterTest = searchParams.get('test');
|
|
533
|
+
} else {
|
|
534
|
+
this._filterTest = undefined;
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
this._filterFile = undefined;
|
|
538
|
+
this._filterTest = undefined;
|
|
539
|
+
this._selectedBrowserIndex = -1;
|
|
540
|
+
}
|
|
541
|
+
if (searchParams.has('status')) {
|
|
542
|
+
let filterStatus = searchParams.get('status');
|
|
543
|
+
if (filterStatus === FILTER_STATUS.FAILED && data.numFailed === 0) {
|
|
544
|
+
filterStatus = FILTER_STATUS.ALL;
|
|
545
|
+
}
|
|
546
|
+
this._filterStatus = filterStatus;
|
|
547
|
+
}
|
|
548
|
+
if (searchParams.has('browsers')) {
|
|
549
|
+
this._filterBrowsers = searchParams.get('browsers').split(',');
|
|
550
|
+
}
|
|
551
|
+
this._filterHideByteDiff = searchParams.has('bytediff');
|
|
552
|
+
this._updateFiles();
|
|
553
|
+
}
|
|
554
|
+
#navigate(path) {
|
|
555
|
+
window.history.pushState({}, '', path);
|
|
556
|
+
this.#handleLocationChange();
|
|
526
557
|
}
|
|
527
558
|
}
|
|
528
559
|
customElements.define('d2l-vdiff-report-app', App);
|