Skip to content

Commit

Permalink
chore: dependencies 2023-12 (#2652)
Browse files Browse the repository at this point in the history
* chore: update dependencies

* chore: update lit

* chore: update typescript

* chore: update owc testing calls

* chore: update tsconfig

* chore: update lit dependency

* chore: resolve some new linting, type, and static a11y errors

* chore: update node version

* chore: ts-node workaround

* chore: juggle ci

* fix: popover a11y

* fix: popover render

* test: fix popover test

* fix: docs build

* fix: syntax errors (pebcak)

* fix(tools): types for a11ySnapshot

* test: fix types

* fix(tools): types

* chore: fix build

* chore: chalk dep
  • Loading branch information
bennypowers committed Dec 19, 2023
1 parent 502e931 commit 50f462c
Show file tree
Hide file tree
Showing 48 changed files with 7,208 additions and 6,388 deletions.
10 changes: 10 additions & 0 deletions .changeset/tidy-numbers-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@patternfly/pfe-tools": patch
"@patternfly/pfe-core": patch
"@patternfly/elements": patch
---

"@patternfly/elements": major
---

Update dependencies, including Lit version 3
2 changes: 1 addition & 1 deletion .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: npm

- name: Bundle
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: npm

- name: Verify JSPM URL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: npm

- run: npm ci --prefer-offline
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ jobs:
# steps:
# - name: Debugging context variables
# run: echo "$GITHUB_CONTEXT"

test:
name: Run test suite (Web Test Runner)
lint:
name: Lint files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -52,7 +51,7 @@ jobs:
- name: Configure node version
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: npm

- name: Install dependencies
Expand All @@ -62,13 +61,32 @@ jobs:
id: lint
run: npm run lint


test:
name: Run test suite (Web Test Runner)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Configures the node version used on GitHub-hosted runners
- name: Configure node version
uses: actions/setup-node@v3
with:
node-version: '20'
cache: npm

- name: Install dependencies
run: npm ci --prefer-offline

- name: install playwright
run: npx playwright install

- name: Run tests
run: npm test
if: ${{ always() }}

- name: JUnit Report Action
uses: mikepenz/action-junit-report@v2.8.2
if: ${{ always() }}
with:
report_paths: test-results/test-results.xml
fail_on_failure: true # fail the actions run if the tests failed
Expand All @@ -79,10 +97,8 @@ jobs:
strategy:
matrix:
node:
- '18'
- '19'
# https://github.com/TypeStrong/ts-node/issues/1997
# - '20'
- '20'
- '21'
if: |
github.event_name == 'workflow_dispatch'
|| github.event_name == 'push'
Expand Down Expand Up @@ -126,8 +142,9 @@ jobs:
validate:
name: Validate successful build on main
needs:
- build
- lint
- test
- build
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/visual-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: npm
- run: npm ci --prefer-offline

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.1
v20.10.0
4 changes: 2 additions & 2 deletions core/pfe-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"test": "wtr --files './test/*.spec.ts' --config ../../web-test-runner.config.js"
},
"dependencies": {
"@floating-ui/dom": "^1.2.6",
"lit": "^2.7.2"
"@floating-ui/dom": "^1.5.3",
"lit": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
15 changes: 9 additions & 6 deletions docs/_data/importMap.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const fs = require('fs');
const path = require('path');
const { promisify } = require('node:util');
const Glob = require('glob');
const glob = promisify(Glob);
const { glob } = require('glob');

const packageLock = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package-lock.json')));

Expand Down Expand Up @@ -46,12 +44,17 @@ const LIT_DEPS = [
'./decorators.js',
'./directive.js',
'./directive-helpers.js',
'./experimental-hydrate-support.js',
'./experimental-hydrate.js',
'./html.js',
'./polyfill-support.js',
'./static-html.js',
]
},
{
target: `@lit-labs/ssr-client`,
subpaths: [
'.',
'./lit-element-hydrate-support.js',
]
}
];

Expand All @@ -69,7 +72,7 @@ module.exports = async function() {
const { Generator } = await import('@jspm/generator');

const generator = new Generator({
defaultProvider: 'jspm',
defaultProvider: 'jspm.io',
env: ['production', 'browser', 'module']
});

Expand Down
2 changes: 1 addition & 1 deletion docs/_plugins/create-import-map.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = function(eleventyConfig) {
const { Generator } = await import('@jspm/generator');

const generator = new Generator({
defaultProvider: 'jspm',
defaultProvider: 'jspm.io',
env: ['production', 'browser', 'module']
});

Expand Down
22 changes: 11 additions & 11 deletions docs/docs/develop/import-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ Once you've generated your import map and added it to your project, you can use
<script type="importmap">
{
"imports": {
"@patternfly/elements/pf-card/pf-card.js": "https://ga.jspm.io/npm:@patternfly/elements@2.0.0/pf-card/pf-card.js"
"@patternfly/elements/pf-card/pf-card.js": "https://ga.jspm.io/npm:@patternfly/elements@2.5.0/pf-card/pf-card.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@lit/reactive-element": "https://ga.jspm.io/npm:@lit/reactive-element@1.6.1/reactive-element.js",
"@lit/reactive-element/decorators/": "https://ga.jspm.io/npm:@lit/reactive-element@1.6.1/decorators/",
"@patternfly/pfe-core/controllers/slot-controller.js": "https://ga.jspm.io/npm:@patternfly/pfe-core@2.0.0/controllers/slot-controller.js",
"lit": "https://ga.jspm.io/npm:lit@2.6.1/index.js",
"lit-element/lit-element.js": "https://ga.jspm.io/npm:lit-element@3.2.2/lit-element.js",
"lit-html": "https://ga.jspm.io/npm:lit-html@2.6.1/lit-html.js",
"lit-html/": "https://ga.jspm.io/npm:lit-html@2.6.1/",
"lit/": "https://ga.jspm.io/npm:lit@2.6.1/",
"@lit/reactive-element": "https://ga.jspm.io/npm:@lit/reactive-element@2.0.2/reactive-element.js",
"@lit/reactive-element/decorators/": "https://ga.jspm.io/npm:@lit/reactive-element@2.0.2/decorators/",
"@patternfly/pfe-core/controllers/slot-controller.js": "https://ga.jspm.io/npm:@patternfly/pfe-core@2.1.0/controllers/slot-controller.js",
"lit": "https://ga.jspm.io/npm:lit@3.1.0/index.js",
"lit-element/lit-element.js": "https://ga.jspm.io/npm:lit-element@4.0.2/lit-element.js",
"lit-html": "https://ga.jspm.io/npm:lit-html@3.1.0/lit-html.js",
"lit-html/": "https://ga.jspm.io/npm:lit-html@3.1.0/",
"lit/": "https://ga.jspm.io/npm:lit@3.1.0/",
"tslib": "https://ga.jspm.io/npm:tslib@2.5.0/modules/index.js"
}
}
Expand All @@ -86,8 +86,8 @@ Once you've generated your import map and added it to your project, you can use

```javascript
<script type="module">
// resolves to https://ga.jspm.io/npm:@patternfly/elements@2.0.0/pf-card/pf-card.js
import '@patternfly/elements/pf-card/pf-card.js';
// resolves to https://ga.jspm.io/npm:@patternfly/elements@2.5.0/pf-card/pf-card.js
import '@patternfly/elements/pf-card/pf-card.js';
</script>
```

Expand Down
8 changes: 4 additions & 4 deletions elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@
"Mark Caron <mark@redhat.com> (https://github.com/markcaron)",
"Michael Clayton <mclayton@redhat.com>",
"Michael Potter",
"Steven Spriggs <sspriggs@redhat.com",
"Steven Spriggs <sspriggs@redhat.com>",
"castastrophe (https://github.com/castastrophe)",
"Wes Ruvalcaba"
],
"dependencies": {
"@patternfly/icons": "^1.0.2",
"@patternfly/pfe-core": "^2.4.0",
"lit": "2.6.1",
"tslib": "^2.4.1"
"@patternfly/pfe-core": "^2.4.1",
"lit": "^3.1.0",
"tslib": "^2.6.2"
}
}
2 changes: 1 addition & 1 deletion elements/pf-avatar/test/pf-avatar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('<pf-avatar>', function() {
beforeEach(async function() {
element = await createFixture(html`<pf-avatar @load="${onLoad}"></pf-avatar>`);
setTimeout(() => element.src = datauri);
await oneEvent(element, 'load');
await oneEvent(element, 'load', false);
});
it('loads the image', function() {
expect(loaded).to.equal(datauri);
Expand Down
2 changes: 2 additions & 0 deletions elements/pf-button/BaseButton.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// we will shortly remove this file in #2631
/* eslint-disable lit-a11y/no-aria-slot */
import type { TemplateResult } from 'lit';
import { LitElement, html } from 'lit';
import { property } from 'lit/decorators/property.js';
Expand Down
12 changes: 6 additions & 6 deletions elements/pf-icon/test/pf-icon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('<pf-icon>', function() {
let element: PfIcon;

async function expectIconsEqual(actualIconUrl: URL) {
await oneEvent(element, 'load');
await oneEvent(element, 'load', false);
const tpl = await import(actualIconUrl.pathname).then(x => x.default);
const rootNode = render(tpl, document.createDocumentFragment());
const actual = element.shadowRoot?.querySelector('svg');
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('<pf-icon>', function() {
element.innerHTML = `<p>Icon failed to load.</p>`;
// Check that the fallback is hidden when the icon is successfully loaded
element.icon = 'bike';
await oneEvent(element, 'load');
await oneEvent(element, 'load', false);
expect(element).shadowDom.to.equal(`
<div id="container" aria-hidden="true">
<span part="fallback" hidden>
Expand All @@ -89,7 +89,7 @@ describe('<pf-icon>', function() {
const newColor = 'rgb(11, 12, 13)';
element.style.setProperty('color', newColor);
element.icon = 'atom';
await oneEvent(element, 'load');
await oneEvent(element, 'load', false);
const color = getComputedStyle(element.shadowRoot!.querySelector('svg')!).getPropertyValue('color');
expect(color).to.equal(newColor);
});
Expand Down Expand Up @@ -117,14 +117,14 @@ describe('<pf-icon>', function() {
element.icon = 'foo';
await element.updateComplete;
PfIcon.addIconSet('asdfasdf', () => url);
await oneEvent(element, 'load');
await oneEvent(element, 'load', false);
await expectIconsEqual(url);
});

it(`should show fallback when given a valid icon set but invalid icon name, fallback provided`, async function() {
element.innerHTML = '<p>Image failed to load.</p>.';
element.icon = 'no-scrubs';
await oneEvent(element, 'error');
await oneEvent(element, 'error', false);
expect(element.shadowRoot!.querySelector('svg')).to.not.be.ok;
expect(element).shadowDom.to.equal(`
<div id="container" aria-hidden="true">
Expand All @@ -138,7 +138,7 @@ describe('<pf-icon>', function() {
element.innerHTML = '<p>Image failed to load.</p>.';
element.set = 'choopee-doopee-pie';
element.icon = 'bike';
await oneEvent(element, 'error');
await oneEvent(element, 'error', false);
expect(element.shadowRoot!.querySelector('svg')).to.not.be.ok;
expect(element).shadowDom.to.equal(`
<div id="container" aria-hidden="true">
Expand Down
8 changes: 3 additions & 5 deletions elements/pf-jump-links/pf-jump-links-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ export class PfJumpLinksList extends LitElement {
static readonly styles = [style];

render() {
return html`
<div id="container" role="listbox">
<slot></slot>
</div>
`;
// TODO: add label
// eslint-disable-next-line lit-a11y/accessible-name
return html`<div id="container" role="listbox"><slot></slot></div>`;
}
}

Expand Down
8 changes: 6 additions & 2 deletions elements/pf-jump-links/pf-jump-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,14 @@ export class PfJumpLinks extends LitElement {
<pf-icon icon="chevron-right"></pf-icon>
<span id="label">${this.label}</span>
</summary>
<slot role="listbox" @slotchange="${this.#updateItems}"></slot>
<div role="listbox" aria-labelledby="label">
<slot @slotchange="${this.#updateItems}"></slot>
</div>
</details>` : html`
<span id="label">${this.label}</span>
<slot role="listbox" @slotchange="${this.#updateItems}"></slot>`}
<div role="listbox" aria-labelledby="label">
<slot @slotchange="${this.#updateItems}"></slot>
</div>`}
</nav>
`;
}
Expand Down
1 change: 0 additions & 1 deletion elements/pf-jump-links/test/pf-jump-links.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ReactiveElement } from 'lit';
import { expect, html, nextFrame } from '@open-wc/testing';
import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
import { sendKeys } from '@web/test-runner-commands';
Expand Down
8 changes: 6 additions & 2 deletions elements/pf-panel/pf-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ export class PfPanel extends LitElement {
const hasHeader = this.#slots.hasSlotted('header');
const hasFooter = this.#slots.hasSlotted('footer');
return html`
<slot name="header" role="region" ?hidden="${!hasHeader}"></slot>
<header>
<slot name="header" ?hidden="${!hasHeader}"></slot>
</header>
<hr role="presentation" ?hidden="${!hasHeader}">
<slot></slot>
<slot name="footer" role="region" ?hidden="${!hasFooter}"></slot>
<footer>
<slot name="footer" ?hidden="${!hasFooter}"></slot>
</footer>
`;
}
}
Expand Down

0 comments on commit 50f462c

Please sign in to comment.