@universal-ember/test-support 0.0.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/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # test-support
2
+
3
+ [Short description of the addon.]
4
+
5
+ ## Compatibility
6
+
7
+ - Ember.js v4.12 or above
8
+ - Embroider or ember-auto-import v2
9
+
10
+ ## Installation
11
+
12
+ ```
13
+ ember install test-support
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ [Longer description of how to use the addon in apps.]
19
+
20
+ ## Contributing
21
+
22
+ See the [Contributing](CONTRIBUTING.md) guide for details.
23
+
24
+ ## License
25
+
26
+ This project is licensed under the [MIT License](LICENSE.md).
package/addon-main.cjs ADDED
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ const { addonV1Shim } = require('@embroider/addon-shim');
4
+ module.exports = addonV1Shim(__dirname);
@@ -0,0 +1,2 @@
1
+ export { visitAllLinks } from './routing/visit-all.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function visitAllLinks(): Promise<void>;
2
+ //# sourceMappingURL=visit-all.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visit-all.d.ts","sourceRoot":"","sources":["../../src/routing/visit-all.ts"],"names":[],"mappings":"AAeA,wBAAsB,aAAa,kBA4ClC"}
@@ -0,0 +1,3 @@
1
+ export default interface Registry {
2
+ }
3
+ //# sourceMappingURL=template-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,WAAW,QAAQ;CAEhC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { visitAllLinks } from './routing/visit-all.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ import { assert as assert$1 } from '@ember/debug';
2
+ import { visit, currentURL, find, click, findAll } from '@ember/test-helpers';
3
+ import QUnit from 'qunit';
4
+
5
+ function findInAppLinks() {
6
+ return findAll('a')?.map(link => link.getAttribute('href'))?.filter(href => !href?.startsWith('http')).filter(Boolean) || [];
7
+ }
8
+ const assert = QUnit.assert;
9
+ async function visitAllLinks() {
10
+ /**
11
+ * string of "on::target"
12
+ */
13
+ const visited = new Set();
14
+ let returnTo = '/';
15
+ await visit(returnTo);
16
+ const inAppLinks = findInAppLinks();
17
+ const queue = [...inAppLinks];
18
+ while (queue.length > 0) {
19
+ const toVisit = queue.shift();
20
+ assert$1(`Queue entries cannot be falsey`, toVisit);
21
+ if (typeof toVisit === 'object' && toVisit !== null) {
22
+ returnTo = toVisit.changeReturnTo;
23
+ continue;
24
+ }
25
+ const key = `${currentURL()}::${toVisit}`;
26
+ if (visited.has(key)) continue;
27
+ await visit(returnTo);
28
+ const link = find(`a[href="${toVisit}"]`);
29
+ assert$1(`link exists with ${toVisit}`, link);
30
+ await click(link);
31
+ assert.ok(currentURL().startsWith(toVisit), `Navigation was successful: to:${toVisit}, from:${returnTo}`);
32
+ visited.add(key);
33
+ const links = findInAppLinks();
34
+ queue.push({
35
+ changeReturnTo: currentURL()
36
+ });
37
+ queue.push(...links);
38
+ }
39
+ }
40
+
41
+ export { visitAllLinks };
42
+ //# sourceMappingURL=visit-all.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visit-all.js","sources":["../../src/routing/visit-all.ts"],"sourcesContent":["import { assert as debugAssert } from '@ember/debug';\nimport { click, currentURL, findAll } from '@ember/test-helpers';\nimport { visit } from '@ember/test-helpers';\nimport { find } from '@ember/test-helpers';\nimport QUnit from 'qunit';\n\nfunction findInAppLinks(): string[] {\n return (findAll('a')\n ?.map((link) => link.getAttribute('href'))\n ?.filter((href) => !href?.startsWith('http'))\n .filter(Boolean) || []) as string[];\n}\n\nconst assert = QUnit.assert;\n\nexport async function visitAllLinks() {\n /**\n * string of \"on::target\"\n */\n const visited = new Set();\n let returnTo = '/';\n\n await visit(returnTo);\n\n const inAppLinks = findInAppLinks();\n const queue: (string | { changeReturnTo: string })[] = [...inAppLinks];\n\n while (queue.length > 0) {\n const toVisit = queue.shift();\n\n debugAssert(`Queue entries cannot be falsey`, toVisit);\n\n if (typeof toVisit === 'object' && toVisit !== null) {\n returnTo = toVisit.changeReturnTo;\n continue;\n }\n\n const key = `${currentURL()}::${toVisit}`;\n\n if (visited.has(key)) continue;\n\n await visit(returnTo);\n\n const link = find(`a[href=\"${toVisit}\"]`);\n\n debugAssert(`link exists with ${toVisit}`, link);\n\n await click(link);\n assert.ok(\n currentURL().startsWith(toVisit),\n `Navigation was successful: to:${toVisit}, from:${returnTo}`,\n );\n visited.add(key);\n\n const links = findInAppLinks();\n\n queue.push({ changeReturnTo: currentURL() });\n queue.push(...links);\n }\n}\n"],"names":["findInAppLinks","findAll","map","link","getAttribute","filter","href","startsWith","Boolean","assert","QUnit","visitAllLinks","visited","Set","returnTo","visit","inAppLinks","queue","length","toVisit","shift","debugAssert","changeReturnTo","key","currentURL","has","find","click","ok","add","links","push"],"mappings":";;;;AAMA,SAASA,cAAcA,GAAa;AAClC,EAAA,OAAQC,OAAO,CAAC,GAAG,CAAC,EAChBC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,YAAY,CAAC,MAAM,CAAC,CAAC,EACxCC,MAAM,CAAEC,IAAI,IAAK,CAACA,IAAI,EAAEC,UAAU,CAAC,MAAM,CAAC,CAAC,CAC5CF,MAAM,CAACG,OAAO,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAA;AAEA,MAAMC,MAAM,GAAGC,KAAK,CAACD,MAAM,CAAA;AAEpB,eAAeE,aAAaA,GAAG;AACpC;AACF;AACA;AACE,EAAA,MAAMC,OAAO,GAAG,IAAIC,GAAG,EAAE,CAAA;EACzB,IAAIC,QAAQ,GAAG,GAAG,CAAA;EAElB,MAAMC,KAAK,CAACD,QAAQ,CAAC,CAAA;AAErB,EAAA,MAAME,UAAU,GAAGhB,cAAc,EAAE,CAAA;AACnC,EAAA,MAAMiB,KAA8C,GAAG,CAAC,GAAGD,UAAU,CAAC,CAAA;AAEtE,EAAA,OAAOC,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;AACvB,IAAA,MAAMC,OAAO,GAAGF,KAAK,CAACG,KAAK,EAAE,CAAA;AAE7BC,IAAAA,QAAW,CAAE,CAAA,8BAAA,CAA+B,EAAEF,OAAO,CAAC,CAAA;IAEtD,IAAI,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,IAAI,EAAE;MACnDL,QAAQ,GAAGK,OAAO,CAACG,cAAc,CAAA;AACjC,MAAA,SAAA;AACF,KAAA;IAEA,MAAMC,GAAG,GAAI,CAAEC,EAAAA,UAAU,EAAG,CAAA,EAAA,EAAIL,OAAQ,CAAC,CAAA,CAAA;AAEzC,IAAA,IAAIP,OAAO,CAACa,GAAG,CAACF,GAAG,CAAC,EAAE,SAAA;IAEtB,MAAMR,KAAK,CAACD,QAAQ,CAAC,CAAA;AAErB,IAAA,MAAMX,IAAI,GAAGuB,IAAI,CAAE,CAAUP,QAAAA,EAAAA,OAAQ,IAAG,CAAC,CAAA;AAEzCE,IAAAA,QAAW,CAAE,CAAmBF,iBAAAA,EAAAA,OAAQ,CAAC,CAAA,EAAEhB,IAAI,CAAC,CAAA;IAEhD,MAAMwB,KAAK,CAACxB,IAAI,CAAC,CAAA;AACjBM,IAAAA,MAAM,CAACmB,EAAE,CACPJ,UAAU,EAAE,CAACjB,UAAU,CAACY,OAAO,CAAC,EAC/B,CAAA,8BAAA,EAAgCA,OAAQ,CAASL,OAAAA,EAAAA,QAAS,EAC7D,CAAC,CAAA;AACDF,IAAAA,OAAO,CAACiB,GAAG,CAACN,GAAG,CAAC,CAAA;AAEhB,IAAA,MAAMO,KAAK,GAAG9B,cAAc,EAAE,CAAA;IAE9BiB,KAAK,CAACc,IAAI,CAAC;MAAET,cAAc,EAAEE,UAAU,EAAC;AAAE,KAAC,CAAC,CAAA;AAC5CP,IAAAA,KAAK,CAACc,IAAI,CAAC,GAAGD,KAAK,CAAC,CAAA;AACtB,GAAA;AACF;;;;"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=template-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@universal-ember/test-support",
3
+ "version": "0.0.0",
4
+ "description": "The default blueprint for Embroider v2 addons.",
5
+ "keywords": [
6
+ "ember-addon"
7
+ ],
8
+ "repository": "",
9
+ "license": "MIT",
10
+ "author": "",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./declarations/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./*": {
17
+ "types": "./declarations/*.d.ts",
18
+ "default": "./dist/*.js"
19
+ },
20
+ "./addon-main.js": "./addon-main.cjs"
21
+ },
22
+ "typesVersions": {
23
+ "*": {
24
+ "*": [
25
+ "declarations/*"
26
+ ]
27
+ }
28
+ },
29
+ "files": [
30
+ "addon-main.cjs",
31
+ "declarations",
32
+ "dist"
33
+ ],
34
+ "scripts": {
35
+ "build": "concurrently 'npm:build:*'",
36
+ "build:js": "rollup --config",
37
+ "build:types": "glint --declaration",
38
+ "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
39
+ "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
40
+ "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
41
+ "lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
42
+ "lint:js": "eslint . --cache",
43
+ "lint:js:fix": "eslint . --fix",
44
+ "lint:types": "glint",
45
+ "prepack": "rollup --config",
46
+ "start": "concurrently 'npm:start:*'",
47
+ "start:js": "rollup --config --watch --no-watch.clearScreen",
48
+ "start:types": "glint --declaration --watch",
49
+ "test": "echo 'A v2 addon does not have tests, run tests in test-app'"
50
+ },
51
+ "dependencies": {
52
+ "@ember/test-helpers": "^3.2.1",
53
+ "@embroider/addon-shim": "^1.8.7",
54
+ "decorator-transforms": "^1.0.1"
55
+ },
56
+ "devDependencies": {
57
+ "@babel/core": "^7.23.6",
58
+ "@babel/plugin-transform-typescript": "^7.23.6",
59
+ "@babel/runtime": "^7.17.0",
60
+ "@embroider/addon-dev": "^4.1.0",
61
+ "@glint/core": "^1.2.1",
62
+ "@glint/environment-ember-loose": "^1.2.1",
63
+ "@glint/environment-ember-template-imports": "^1.2.1",
64
+ "@glint/template": "^1.2.1",
65
+ "@rollup/plugin-babel": "^6.0.4",
66
+ "@tsconfig/ember": "^3.0.2",
67
+ "@types/ember": "^4.0.10",
68
+ "@types/ember__application": "^4.0.10",
69
+ "@types/ember__array": "^4.0.9",
70
+ "@types/ember__component": "^4.0.21",
71
+ "@types/ember__controller": "^4.0.11",
72
+ "@types/ember__debug": "^4.0.7",
73
+ "@types/ember__destroyable": "^4.0.4",
74
+ "@types/ember__engine": "^4.0.10",
75
+ "@types/ember__error": "^4.0.5",
76
+ "@types/ember__helper": "^4.0.5",
77
+ "@types/ember__modifier": "^4.0.8",
78
+ "@types/ember__object": "^4.0.11",
79
+ "@types/ember__owner": "^4.0.8",
80
+ "@types/ember__polyfills": "^4.0.5",
81
+ "@types/ember__routing": "^4.0.19",
82
+ "@types/ember__runloop": "^4.0.8",
83
+ "@types/ember__service": "^4.0.8",
84
+ "@types/ember__string": "^3.16.3",
85
+ "@types/ember__template": "^4.0.5",
86
+ "@types/ember__test": "^4.0.5",
87
+ "@types/ember__utils": "^4.0.6",
88
+ "@types/qunit": "^2.19.10",
89
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
90
+ "@typescript-eslint/parser": "^6.14.0",
91
+ "babel-plugin-ember-template-compilation": "^2.2.1",
92
+ "concurrently": "^8.2.2",
93
+ "ember-template-lint": "^5.13.0",
94
+ "eslint": "^8.56.0",
95
+ "eslint-config-prettier": "^9.1.0",
96
+ "eslint-plugin-ember": "^11.12.0",
97
+ "eslint-plugin-n": "^16.4.0",
98
+ "eslint-plugin-prettier": "^5.0.1",
99
+ "prettier": "^3.1.1",
100
+ "prettier-plugin-ember-template-tag": "^1.1.0",
101
+ "qunit": "^2.20.1",
102
+ "rollup": "^4.9.1",
103
+ "rollup-plugin-copy": "^3.5.0",
104
+ "typescript": "^5.3.3"
105
+ },
106
+ "publishConfig": {
107
+ "registry": "https://registry.npmjs.org"
108
+ },
109
+ "ember": {
110
+ "edition": "octane"
111
+ },
112
+ "ember-addon": {
113
+ "version": 2,
114
+ "type": "addon",
115
+ "main": "addon-main.cjs",
116
+ "app-js": {}
117
+ },
118
+ "peerDependencies": {
119
+ "qunit": "^2.20.1"
120
+ }
121
+ }