@leaflink/dom-testing-utils 1.0.0 → 1.0.1
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/dist/global-setup.js +5 -0
- package/dist/global-setup.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/setup-env.d.ts +1 -0
- package/dist/setup-env.js +48 -0
- package/dist/setup-env.js.map +1 -0
- package/dist/setup-env.spec.d.ts +0 -0
- package/dist/setup-env.spec.js.map +1 -0
- package/package.json +4 -1
- package/.github/CONTRIBUTING.md +0 -120
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -19
- package/.github/labeler.yml +0 -4
- package/.github/workflows/labeler.yml +0 -14
- package/.github/workflows/publish-pr.yml +0 -48
- package/.github/workflows/quality-checks.yml +0 -40
- package/.github/workflows/release.yml +0 -52
- package/.nvmrc +0 -1
- package/.prettierrc +0 -20
- package/global-setup.ts +0 -3
- package/index.ts +0 -30
- package/setup-env.spec.js.map +0 -1
- package/setup-env.spec.ts +0 -36
- package/setup-env.ts +0 -65
- package/tsconfig.json +0 -27
- package/vite.config.ts +0 -15
- /package/{setup-env.spec.d.ts → dist/global-setup.d.ts} +0 -0
- /package/{setup-env.spec.js → dist/setup-env.spec.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-setup.js","sourceRoot":"src/","sources":["global-setup.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;IAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC;AACzB,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { screen, waitForElementToBeRemoved } from '@testing-library/vue';
|
|
2
|
+
import { default as userEvent } from '@testing-library/user-event';
|
|
3
|
+
export function waitForLoadingToFinish(textMatch = /ll\-loading|loading\-spinner/) {
|
|
4
|
+
return waitForElementToBeRemoved(() => [...screen.queryAllByTestId(textMatch)], { timeout: 2000 });
|
|
5
|
+
}
|
|
6
|
+
export function cleanupNoty() {
|
|
7
|
+
document
|
|
8
|
+
.querySelectorAll('.noty_bar')
|
|
9
|
+
.forEach((elem) => elem.parentNode?.removeChild(elem));
|
|
10
|
+
}
|
|
11
|
+
export function cleanupDropdowns() {
|
|
12
|
+
document
|
|
13
|
+
.querySelectorAll('.mount-point-container')
|
|
14
|
+
.forEach((elem) => elem.parentNode?.removeChild(elem));
|
|
15
|
+
}
|
|
16
|
+
export async function assertAndDismissNoty(text) {
|
|
17
|
+
const noty = await screen.findByText(text);
|
|
18
|
+
expect(noty).toBeInTheDocument();
|
|
19
|
+
await userEvent.click(noty);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,UAAU,sBAAsB,CACpC,SAAS,GAAG,8BAA8B;IAE1C,OAAO,yBAAyB,CAC9B,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAC7C,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,QAAQ;SACL,gBAAgB,CAAC,WAAW,CAAC;SAC7B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,QAAQ;SACL,gBAAgB,CAAC,wBAAwB,CAAC;SAC1C,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAY;IACrD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAEjC,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { config } from '@vue/test-utils';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { cleanupDropdowns, cleanupNoty } from './index';
|
|
5
|
+
config.global.mocks['$t'] = (msg) => msg;
|
|
6
|
+
const oldWindowLocation = global.window.location;
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
delete global.window.location;
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
global.window.location = Object.defineProperties({}, {
|
|
12
|
+
...Object.getOwnPropertyDescriptors(oldWindowLocation),
|
|
13
|
+
assign: {
|
|
14
|
+
configurable: true,
|
|
15
|
+
value: vi.fn(),
|
|
16
|
+
},
|
|
17
|
+
href: {
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: {
|
|
21
|
+
replace: vi.fn(),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
window.open = vi.fn();
|
|
26
|
+
vi.mock('lodash-es/debounce', () => {
|
|
27
|
+
return { default: vi.fn((fn) => fn) };
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
cleanupNoty();
|
|
32
|
+
cleanupDropdowns();
|
|
33
|
+
});
|
|
34
|
+
afterAll(() => {
|
|
35
|
+
global.window.location = oldWindowLocation;
|
|
36
|
+
});
|
|
37
|
+
const IntersectionObserverMock = vi.fn(() => ({
|
|
38
|
+
get root() {
|
|
39
|
+
return;
|
|
40
|
+
},
|
|
41
|
+
disconnect: vi.fn(),
|
|
42
|
+
observe: vi.fn(),
|
|
43
|
+
takeRecords: vi.fn(),
|
|
44
|
+
unobserve: vi.fn(),
|
|
45
|
+
}));
|
|
46
|
+
vi.stubGlobal('IntersectionObserver', IntersectionObserverMock);
|
|
47
|
+
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ json: vi.fn().mockResolvedValue({}) }));
|
|
48
|
+
//# sourceMappingURL=setup-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-env.js","sourceRoot":"src/","sources":["setup-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC;AAEzC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;AAEjD,SAAS,CAAC,GAAG,EAAE;IACb,mBAAmB;IACnB,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;IAE9B,mBAAmB;IACnB,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAC9C,EAAE,EACF;QACE,GAAG,MAAM,CAAC,yBAAyB,CAAC,iBAAiB,CAAC;QACtD,MAAM,EAAE;YACN,YAAY,EAAE,IAAI;YAClB,KAAK,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,MAAM,CAAC,CAAC;IAE7C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;IAEnB,MAAM,CAAC,SAAS,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACvC,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leaflink/dom-testing-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Frontend DOM testing utilities",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
18
21
|
"scripts": {
|
|
19
22
|
"build": "tsc",
|
|
20
23
|
"lint:commits": "commitlint",
|
package/.github/CONTRIBUTING.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# DOM Testing Utils Contributing Guide
|
|
2
|
-
|
|
3
|
-
## IMPORTANT INFORMATION
|
|
4
|
-
|
|
5
|
-
* For general questions, please ask us in the [#frontend slack](https://app.slack.com/client/T0ENGRQHM/CDXDCR0RX/) channel.
|
|
6
|
-
|
|
7
|
-
## Reporting Issues
|
|
8
|
-
|
|
9
|
-
* Issues can be created in directly in GitHub as there's no dedicated board for this project.
|
|
10
|
-
* When picking the work up you can create the ticket in Jira for your respective pod's board.
|
|
11
|
-
* Bug reproductions should be as **concise** as possible.
|
|
12
|
-
* **Search** for your issue, it _may_ have been answered.
|
|
13
|
-
* See if the error is **reproduceable** with the latest version.
|
|
14
|
-
|
|
15
|
-
## Pull Requests
|
|
16
|
-
|
|
17
|
-
* Always work on a new branch.
|
|
18
|
-
* Bug fixes should be submitted to the `main` branch.
|
|
19
|
-
* For changes and feature requests, please include an example of what you are trying to solve and an example of the markup. It is preferred that you create an issue first however, as that will allow the team to review your proposal before you start.
|
|
20
|
-
* Please reference the issue # that the PR resolves, something like `Fixes #1234` or `Resolves #6458` (See [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
|
|
21
|
-
|
|
22
|
-
## Semantic Release
|
|
23
|
-
|
|
24
|
-
This repo leverages [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/). This automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.
|
|
25
|
-
|
|
26
|
-
This removes the immediate connection between human emotions and version numbers, strictly following the [Semantic Versioning](http://semver.org/) specification.
|
|
27
|
-
|
|
28
|
-
- Fully **automated** releases, no human intervention needed.
|
|
29
|
-
- Developers only need to worry about the changes in their own code and learning how to structure their commit messages a little bit differently using "conventional commits". They don't need to analyze the commit history themselves and dictate version bumps
|
|
30
|
-
- Enforces [Semantic Versioning](https://semver.org/) specification.
|
|
31
|
-
- Enforces good git practices!
|
|
32
|
-
- New features and fixes are immediately available to users
|
|
33
|
-
- Use formalized commit message convention to document changes in the codebase
|
|
34
|
-
- Publish on different distribution channels (such as [npm dist-tags](https://docs.npmjs.com/cli/dist-tag)) based on git merges
|
|
35
|
-
- Avoid potential errors associated with manual releases
|
|
36
|
-
|
|
37
|
-
### Commit Conventions
|
|
38
|
-
|
|
39
|
-
`semantic-release` uses the commit messages to determine the type of changes in the codebase. Following [formalized conventions for commit messages](https://www.conventionalcommits.org/en/v1.0.0/), `semantic-release` automatically determines the next semantic version number, generates a changelog and publishes the release.
|
|
40
|
-
|
|
41
|
-
- `feat`: A new feature
|
|
42
|
-
- `fix`: A bug fix
|
|
43
|
-
- `perf`: A code change that improves performance
|
|
44
|
-
- `chore`: Changes to the build process or auxiliary tools and libraries (example scopes: gulp, broccoli, npm)
|
|
45
|
-
- `revert`: If the commit reverts a previous commit, it should begin with `revert: `
|
|
46
|
-
- `docs`: Documentation only changes
|
|
47
|
-
- `style`: Changes that dont affect the meaning of the code (white-space, formatting, etc)
|
|
48
|
-
- `refactor`: A code change that neither fixes a bug nor adds a feature
|
|
49
|
-
- `test`: Adding missing or correcting existing tests
|
|
50
|
-
- `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
|
51
|
-
|
|
52
|
-
> 💡 **ONLY** `feat`, `fix`, `revert` and `perf` will cut releases by default...
|
|
53
|
-
> the rest will just show up on future release changelogs but will not trigger a
|
|
54
|
-
> release on their own because they don't effect the application.
|
|
55
|
-
|
|
56
|
-
**Patch Release**
|
|
57
|
-
|
|
58
|
-
```txt
|
|
59
|
-
fix(pencil): stop graphite breaking when too much pressure applied
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**Minor/Feature Release**
|
|
63
|
-
|
|
64
|
-
```txt
|
|
65
|
-
feat(pencil): add 'graphiteWidth' option
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Major Release**
|
|
69
|
-
|
|
70
|
-
```txt
|
|
71
|
-
perf(pencil): remove graphiteWidth option
|
|
72
|
-
|
|
73
|
-
BREAKING CHANGE: The graphiteWidth option has been removed.
|
|
74
|
-
The default graphite width of 10mm is always used for performance reasons.
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Manual Releases
|
|
78
|
-
|
|
79
|
-
This project has an automated release set up. So things are only released when
|
|
80
|
-
there are useful changes in the code that justify a release. But sometimes
|
|
81
|
-
things get messed up one way or another and we need to trigger the release
|
|
82
|
-
ourselves. When this happens, simply bump the number below and commit that with
|
|
83
|
-
the following commit message based on your needs:
|
|
84
|
-
|
|
85
|
-
**Patch**
|
|
86
|
-
|
|
87
|
-
```txt
|
|
88
|
-
fix(release): manually release a patch version
|
|
89
|
-
|
|
90
|
-
There was an issue with a patch release, so this manual-releases.md
|
|
91
|
-
change is to release a new patch version.
|
|
92
|
-
|
|
93
|
-
Reference: #<the number of a relevant pull request, issue, or commit>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Minor**
|
|
97
|
-
|
|
98
|
-
```txt
|
|
99
|
-
feat(release): manually release a minor version
|
|
100
|
-
|
|
101
|
-
There was an issue with a minor release, so this manual-releases.md
|
|
102
|
-
change is to release a new minor version.
|
|
103
|
-
|
|
104
|
-
Reference: #<the number of a relevant pull request, issue, or commit>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Major**
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
fix(release): manually release a major version
|
|
111
|
-
|
|
112
|
-
There was an issue with a major release, so this manual-releases.md
|
|
113
|
-
change is to release a new major version.
|
|
114
|
-
|
|
115
|
-
Reference: #<the number of a relevant pull request, issue, or commit>
|
|
116
|
-
|
|
117
|
-
BREAKING CHANGE: <mention any relevant breaking changes (this is what triggers the major version change so don't skip this!)>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
The number of times we've had to do a manual release is: 0
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
### Describe the PR
|
|
2
|
-
|
|
3
|
-
[//]: # (A clear and concise description of what the pull request does.)
|
|
4
|
-
|
|
5
|
-
## Types of changes (check at least one)
|
|
6
|
-
|
|
7
|
-
- [ ] Bug fix (non-breaking change which fixes an issue). Requires a patch version update
|
|
8
|
-
- [ ] Feature (adds new / enhances existing feature). Requires a minor version update
|
|
9
|
-
- [ ] Improvement (non-breaking change or refactor that makes things better) Requires a patch version update
|
|
10
|
-
- [ ] Documentation update (improves documentation or typo fixes). Requires a patch version update
|
|
11
|
-
- [ ] Other (please describe)
|
|
12
|
-
|
|
13
|
-
**If new features/enhancement/fixes are added or changed:**
|
|
14
|
-
|
|
15
|
-
- [ ] Includes documentation updates
|
|
16
|
-
- [ ] Includes component package.json meta section updates
|
|
17
|
-
- [ ] New/updated tests are included (required for new features and enhancements)
|
|
18
|
-
- [ ] New/updated stories are included (required for new features and enhancements)
|
|
19
|
-
- [ ] The changes have not impacted the functionality of other components or directives
|
package/.github/labeler.yml
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
name: Publish PR Version
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [labeled]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
publish-pr:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
|
|
11
|
-
if: github.event.label.name == 'Publish PR Version'
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
|
|
16
|
-
- uses: actions/setup-node@v3
|
|
17
|
-
with:
|
|
18
|
-
node-version-file: '.nvmrc'
|
|
19
|
-
registry-url: 'https://registry.npmjs.org'
|
|
20
|
-
|
|
21
|
-
- name: Install dependencies
|
|
22
|
-
run: npm install --no-save
|
|
23
|
-
|
|
24
|
-
- name: Build
|
|
25
|
-
run: npm run build
|
|
26
|
-
|
|
27
|
-
- name: Publish to npm
|
|
28
|
-
id: pr-publish
|
|
29
|
-
run: |
|
|
30
|
-
version="0.0.0-PR-${PR}--$(echo ${SHA} | cut -c -7)"
|
|
31
|
-
npm version $version --no-git-tag-version
|
|
32
|
-
npm publish --access public --tag pr
|
|
33
|
-
echo "pr_version=$version" >> $GITHUB_OUTPUT
|
|
34
|
-
env:
|
|
35
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
36
|
-
PR: ${{ github.event.number }}
|
|
37
|
-
SHA: ${{ github.event.pull_request.head.sha }}
|
|
38
|
-
|
|
39
|
-
- uses: actions/github-script@v3
|
|
40
|
-
with:
|
|
41
|
-
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
42
|
-
script: |
|
|
43
|
-
github.issues.createComment({
|
|
44
|
-
issue_number: context.issue.number,
|
|
45
|
-
owner: context.repo.owner,
|
|
46
|
-
repo: context.repo.repo,
|
|
47
|
-
body: '🚀 PR version published: `${{ steps.pr-publish.outputs.pr_version }}`'
|
|
48
|
-
})
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
name: PR Quality Checks
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
# run on push to main branch too for coveralls
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- main
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
quality-checks:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
strategy:
|
|
15
|
-
matrix:
|
|
16
|
-
node: [18.x]
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v3
|
|
20
|
-
with:
|
|
21
|
-
fetch-depth: 0
|
|
22
|
-
|
|
23
|
-
- uses: actions/setup-node@v3
|
|
24
|
-
with:
|
|
25
|
-
node-version: ${{ matrix.node }}
|
|
26
|
-
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: npm install --no-save
|
|
29
|
-
|
|
30
|
-
- name: Lint commit messages
|
|
31
|
-
run:
|
|
32
|
-
npm run lint:commits -- --from="origin/${{ github.base_ref }}"
|
|
33
|
-
--to="origin/${{github.head_ref }}"
|
|
34
|
-
if: github.event_name == 'pull_request'
|
|
35
|
-
|
|
36
|
-
- name: Type check code
|
|
37
|
-
run: npm run build -- --noEmit
|
|
38
|
-
|
|
39
|
-
- name: Run tests with coverage
|
|
40
|
-
run: npm run test
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
- alpha
|
|
8
|
-
- beta
|
|
9
|
-
- next
|
|
10
|
-
- 'next-major'
|
|
11
|
-
- '[0-9]+.x'
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
release:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
concurrency:
|
|
18
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
|
19
|
-
cancel-in-progress: true
|
|
20
|
-
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v3
|
|
23
|
-
|
|
24
|
-
- uses: actions/setup-node@v3
|
|
25
|
-
with:
|
|
26
|
-
node-version-file: '.nvmrc'
|
|
27
|
-
|
|
28
|
-
- name: Install dependencies
|
|
29
|
-
run: npm install --no-save
|
|
30
|
-
|
|
31
|
-
- name: Run checks before releasing
|
|
32
|
-
run: npm run test
|
|
33
|
-
|
|
34
|
-
- name: Build
|
|
35
|
-
run: npm run build
|
|
36
|
-
|
|
37
|
-
- name: Semantic Release
|
|
38
|
-
uses: docker://ghcr.io/codfish/semantic-release-action@sha256:601fd6c1db9efbcfabd34ba4563e7d0b9eb0f8ba11316e3e7d6a9b6883dac8ba
|
|
39
|
-
id: semantic
|
|
40
|
-
with:
|
|
41
|
-
branches: |
|
|
42
|
-
[
|
|
43
|
-
'+([0-9])?(.{+([0-9]),x}).x',
|
|
44
|
-
'main',
|
|
45
|
-
'next',
|
|
46
|
-
'next-major',
|
|
47
|
-
{name: 'beta', prerelease: true},
|
|
48
|
-
{name: 'alpha', prerelease: true}
|
|
49
|
-
]
|
|
50
|
-
env:
|
|
51
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v18
|
package/.prettierrc
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"arrowParens": "always",
|
|
3
|
-
"bracketSameLine": false,
|
|
4
|
-
"bracketSpacing": true,
|
|
5
|
-
"embeddedLanguageFormatting": "auto",
|
|
6
|
-
"endOfLine": "lf",
|
|
7
|
-
"htmlWhitespaceSensitivity": "css",
|
|
8
|
-
"insertPragma": false,
|
|
9
|
-
"jsxSingleQuote": false,
|
|
10
|
-
"printWidth": 80,
|
|
11
|
-
"proseWrap": "always",
|
|
12
|
-
"quoteProps": "as-needed",
|
|
13
|
-
"requirePragma": false,
|
|
14
|
-
"semi": true,
|
|
15
|
-
"singleQuote": true,
|
|
16
|
-
"tabWidth": 2,
|
|
17
|
-
"trailingComma": "all",
|
|
18
|
-
"useTabs": false,
|
|
19
|
-
"vueIndentScriptAndStyle": true
|
|
20
|
-
}
|
package/global-setup.ts
DELETED
package/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { screen, waitForElementToBeRemoved } from '@testing-library/vue';
|
|
2
|
-
import { default as userEvent } from '@testing-library/user-event';
|
|
3
|
-
|
|
4
|
-
export function waitForLoadingToFinish(
|
|
5
|
-
textMatch = /ll\-loading|loading\-spinner/,
|
|
6
|
-
): Promise<void> {
|
|
7
|
-
return waitForElementToBeRemoved(
|
|
8
|
-
() => [...screen.queryAllByTestId(textMatch)],
|
|
9
|
-
{ timeout: 2000 },
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function cleanupNoty(): void {
|
|
14
|
-
document
|
|
15
|
-
.querySelectorAll('.noty_bar')
|
|
16
|
-
.forEach((elem) => elem.parentNode?.removeChild(elem));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function cleanupDropdowns(): void {
|
|
20
|
-
document
|
|
21
|
-
.querySelectorAll('.mount-point-container')
|
|
22
|
-
.forEach((elem) => elem.parentNode?.removeChild(elem));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function assertAndDismissNoty(text: string): Promise<void> {
|
|
26
|
-
const noty = await screen.findByText(text);
|
|
27
|
-
expect(noty).toBeInTheDocument();
|
|
28
|
-
|
|
29
|
-
await userEvent.click(noty);
|
|
30
|
-
}
|
package/setup-env.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-env.spec.js","sourceRoot":"","sources":["setup-env.spec.ts"],"names":[],"mappings":";AAAA,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;IACxC,MAAM,GAAG,GAAG,QAAQ,CAAC;IAErB,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEzC,MAAM,CAAC,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
5
|
-
|
|
6
|
-
expect(openSpy).not.toHaveBeenCalled();
|
|
7
|
-
|
|
8
|
-
window.open(url);
|
|
9
|
-
|
|
10
|
-
expect(openSpy).toHaveBeenCalledWith(url);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should stub fetch method', async () => {
|
|
14
|
-
const url = 'my-url';
|
|
15
|
-
|
|
16
|
-
const fetchSpy = vi.spyOn(globalThis, 'fetch');
|
|
17
|
-
|
|
18
|
-
expect(fetchSpy).not.toHaveBeenCalled();
|
|
19
|
-
|
|
20
|
-
await fetch(url);
|
|
21
|
-
|
|
22
|
-
expect(fetchSpy).toHaveBeenCalledWith(url);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it.each([['disconnect'], ['observe'], ['takeRecords'], ['unobserve']])(
|
|
26
|
-
'should stub intersection observer %s method',
|
|
27
|
-
(method: any) => {
|
|
28
|
-
const observer = new globalThis.IntersectionObserver(() => ({}), {});
|
|
29
|
-
|
|
30
|
-
const methodSpy = vi.spyOn(observer, method);
|
|
31
|
-
|
|
32
|
-
observer[method]();
|
|
33
|
-
|
|
34
|
-
expect(methodSpy).toHaveBeenCalled();
|
|
35
|
-
},
|
|
36
|
-
);
|
package/setup-env.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
import { config } from '@vue/test-utils';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
|
|
5
|
-
import { cleanupDropdowns, cleanupNoty } from './index';
|
|
6
|
-
|
|
7
|
-
config.global.mocks['$t'] = (msg) => msg;
|
|
8
|
-
|
|
9
|
-
const oldWindowLocation = global.window.location;
|
|
10
|
-
|
|
11
|
-
beforeAll(() => {
|
|
12
|
-
// @ts-expect-error
|
|
13
|
-
delete global.window.location;
|
|
14
|
-
|
|
15
|
-
// @ts-expect-error
|
|
16
|
-
global.window.location = Object.defineProperties(
|
|
17
|
-
{},
|
|
18
|
-
{
|
|
19
|
-
...Object.getOwnPropertyDescriptors(oldWindowLocation),
|
|
20
|
-
assign: {
|
|
21
|
-
configurable: true,
|
|
22
|
-
value: vi.fn(),
|
|
23
|
-
},
|
|
24
|
-
href: {
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: {
|
|
28
|
-
replace: vi.fn(),
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
window.open = vi.fn();
|
|
35
|
-
|
|
36
|
-
vi.mock('lodash-es/debounce', () => {
|
|
37
|
-
return { default: vi.fn((fn) => fn) };
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
afterEach(() => {
|
|
42
|
-
cleanupNoty();
|
|
43
|
-
cleanupDropdowns();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
afterAll(() => {
|
|
47
|
-
global.window.location = oldWindowLocation;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const IntersectionObserverMock = vi.fn(() => ({
|
|
51
|
-
get root() {
|
|
52
|
-
return;
|
|
53
|
-
},
|
|
54
|
-
disconnect: vi.fn(),
|
|
55
|
-
observe: vi.fn(),
|
|
56
|
-
takeRecords: vi.fn(),
|
|
57
|
-
unobserve: vi.fn(),
|
|
58
|
-
}));
|
|
59
|
-
|
|
60
|
-
vi.stubGlobal('IntersectionObserver', IntersectionObserverMock);
|
|
61
|
-
|
|
62
|
-
vi.stubGlobal(
|
|
63
|
-
'fetch',
|
|
64
|
-
vi.fn().mockResolvedValue({ json: vi.fn().mockResolvedValue({}) }),
|
|
65
|
-
);
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowJs": false,
|
|
4
|
-
"allowSyntheticDefaultImports": true,
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"downlevelIteration": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"importHelpers": true,
|
|
9
|
-
"jsx": "preserve",
|
|
10
|
-
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
|
11
|
-
"types": ["vitest/globals"],
|
|
12
|
-
"module": "esnext",
|
|
13
|
-
"moduleResolution": "node",
|
|
14
|
-
"noImplicitAny": false,
|
|
15
|
-
"noImplicitThis": true,
|
|
16
|
-
"preserveConstEnums": true,
|
|
17
|
-
"removeComments": false,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"strict": true,
|
|
20
|
-
"skipLibCheck": true,
|
|
21
|
-
"sourceMap": true,
|
|
22
|
-
"target": "esnext",
|
|
23
|
-
"typeRoots": ["./node_modules/@types", "."]
|
|
24
|
-
},
|
|
25
|
-
"include": ["src/**/*", "**/*.spec.ts"],
|
|
26
|
-
"exclude": ["node_modules"]
|
|
27
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
coverage: {
|
|
7
|
-
provider: 'c8',
|
|
8
|
-
reporter: process.env.CI ? 'lcov' : ['html', 'text'],
|
|
9
|
-
},
|
|
10
|
-
globals: true,
|
|
11
|
-
include: ['**/*.spec.ts'],
|
|
12
|
-
setupFiles: ['./setup-env.ts'],
|
|
13
|
-
environment: 'jsdom',
|
|
14
|
-
},
|
|
15
|
-
});
|
|
File without changes
|
|
File without changes
|