@open-wc/testing
Advanced tools
Comparing version 3.0.0-next.5 to 3.0.1
116
CHANGELOG.md
# Change Log | ||
## 3.0.1 | ||
### Patch Changes | ||
- 1649ba46: Release bump version as major versions have already been used and unpublished in an accidental publish about a year ago. | ||
- Updated dependencies [1649ba46] | ||
- @open-wc/testing-helpers@2.0.1 | ||
## 3.0.0 | ||
### Major Changes | ||
- 689c9ea3: Upgrade to support latest `lit` package. | ||
- the exports `html` and `unsafeStatic` are now deprecated we recommend to import them directly from `lit/static-html.js`; | ||
- You need to load a polyfill for the scoped registry if you wanna use the `scopedElements` option | ||
- We now enforce our entrypoints via an export map | ||
- The side effect free import got renamed to `pure` | ||
```js | ||
// old | ||
import { fixture } from '@open-wc/testing-helpers/index-no-side-effects.js'; | ||
// new | ||
import { fixture } from '@open-wc/testing-helpers/pure'; | ||
``` | ||
- a5a79a25: We now use an es module version of chai from `@esm-bundle/chai`. | ||
### Minor Changes | ||
- b9b11adc: support snapshot testing with Web Test Runner | ||
- 22c4017c: Undo deprecation of the `html` and `unsafeStatic` exports to enable matching lit versions to what is used in fixture. | ||
A typical testing file looks like this | ||
```js | ||
import { html, fixture } from '@open-wc/testing'; // html will be lit-html 2.x | ||
it('works for tags', async () => { | ||
const el = await fixture( | ||
html` | ||
<my-el></my-el> | ||
`, | ||
); | ||
}); | ||
``` | ||
With this export you can combine the usage of lit-html 2.x for the fixture and template rendering in lit-html 1.x | ||
```js | ||
import { html as fixtureHtml, fixture } from '@open-wc/testing'; // fixtureHtml will be lit-html 2.x | ||
import { html } from 'my-library'; // html will be lit-html 1.x | ||
it('works for tags', async () => { | ||
const el = await fixture(fixtureHtml`<my-el></my-el>`); | ||
}); | ||
it('can be combined', async () => { | ||
class MyExtension extends LibraryComponent { | ||
render() { | ||
// needs to be lit-html 1.x as the library component is using LitElement with lit-html 1.x | ||
return html` | ||
<p>...</p> | ||
`; | ||
} | ||
} | ||
// fixture requires a lit-html 2.x template | ||
const el = await fixture(fixtureHtml`<my-el></my-el>`); | ||
}); | ||
``` | ||
NOTE: If you are using fixture for testing your lit-html 1.x directives then this will no longer work. | ||
A possible workaround for this is | ||
```js | ||
import { html, fixture } from '@open-wc/testing'; // html will be lit-html 2.x | ||
import { render, html as html1, fancyDirective } from 'my-library'; // html and render will be lit-html 1.x | ||
it('is a workaround for directives', async () => { | ||
const node = document.createElement('div'); | ||
render(html1`<p>Testing ${fancyDirective('output')}</p>`, node); | ||
// you can either cleanup yourself or use fixture | ||
const el = await fixture( | ||
html` | ||
${node} | ||
`, | ||
); | ||
expect(el.children[0].innerHTML).toBe('Testing [[output]]'); | ||
}); | ||
``` | ||
### Patch Changes | ||
- 4b9ea6f6: Use lit@2.0 stable based dependencies across the project. | ||
- 40837d10: - use latest axe-core | ||
- allow not required attributes in role testing | ||
- 945d1d9c: Remove unused dependency on `mocha` as the environment should bring it. | ||
- 89fdfa03: Do not generate chai plugins on user install. Do it only on monorepo install. | ||
- 45c7fcc1: Import scoped registries code dynamically to prevent library consumers that do not leverage this API from being bound to its load order requirements. | ||
- Updated dependencies [b9b11adc] | ||
- Updated dependencies [4b9ea6f6] | ||
- Updated dependencies [689c9ea3] | ||
- Updated dependencies [22c4017c] | ||
- Updated dependencies [b6e868d5] | ||
- Updated dependencies [40837d10] | ||
- Updated dependencies [45c7fcc1] | ||
- Updated dependencies [580ce0ee] | ||
- Updated dependencies [72e67571] | ||
- Updated dependencies [6940a3cb] | ||
- @open-wc/semantic-dom-diff@0.19.5 | ||
- @open-wc/testing-helpers@2.0.0 | ||
- chai-a11y-axe@1.3.2 | ||
## 3.0.0-next.5 | ||
@@ -4,0 +120,0 @@ |
{ | ||
"name": "@open-wc/testing", | ||
"version": "3.0.0-next.5", | ||
"version": "3.0.1", | ||
"publishConfig": { | ||
@@ -17,2 +17,3 @@ "access": "public" | ||
"module": "index.js", | ||
"type": "module", | ||
"exports": { | ||
@@ -41,9 +42,9 @@ ".": "./index.js", | ||
"@open-wc/chai-dom-equals": "^0.12.36", | ||
"@open-wc/semantic-dom-diff": "^0.19.5-next.2", | ||
"@open-wc/testing-helpers": "^2.0.0-next.2", | ||
"@open-wc/semantic-dom-diff": "^0.19.5", | ||
"@open-wc/testing-helpers": "^2.0.1", | ||
"@types/chai": "^4.2.11", | ||
"@types/chai-dom": "^0.0.9", | ||
"@types/sinon-chai": "^3.2.3", | ||
"chai-a11y-axe": "^1.3.2-next.0" | ||
"chai-a11y-axe": "^1.3.2" | ||
} | ||
} |
@@ -13,3 +13,3 @@ # Testing >> Testing Package ||10 | ||
Exposes all functions of [@open-wc/testing-helpers](https://github.com/open-wc/open-wc/blob/caacb761e2eff54ddbd42b41547eec1dd8ca3804/docs/docs/testing/helpers.md), so that you have a single package to import from: | ||
Exposes all functions of [@open-wc/testing-helpers](https://github.com/open-wc/open-wc/blob/42ace721290d4d6d8d8d0225c4823f07a64d0b95/docs/docs/testing/helpers.md), so that you have a single package to import from: | ||
@@ -16,0 +16,0 @@ ```javascript |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
74248
0
Yes