Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/actions/setup-node-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,7 @@ runs:
node_modules
key: modules-${{ hashFiles('package-lock.json') }}

- name: Cache Playwright Binaries
id: cache-playwright
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
shell: bash

- name: Install playwright browsers
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
shell: bash

- name: Install system dependencies for WebKit
# Some WebKit dependencies seem to lay outside the cache and will need to be installed separately
if: steps.cache-playwright.outputs.cache-hit == 'true'
run: npx playwright install-deps webkit
shell: bash
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on: [push, pull_request, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.50.1-noble
options: --user 1001

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion editv2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ const element = new DOMParser().parseFromString(
'application/xml',
)!.documentElement;

const update: Update = { element, attributes: {} };
const update: Update = {
element,
attributes: {
attr1: { namespaceURI: 'http://myns.com', value: 'new value' },
},
};
const insert: Insert = { parent: element, node: element, reference: null };
const remove: Remove = { node: element };
const setAttributes: SetAttributes = {
Expand Down
7 changes: 4 additions & 3 deletions editv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ export function isRemove(edit: unknown): edit is Remove {
}

export function isSetAttributes(edit: unknown): edit is SetAttributes {
const setAttrs = edit as SetAttributes;
return (
(edit as SetAttributes).element instanceof Element &&
isAttributesV2((edit as SetAttributes).attributes) &&
isAttributesNS((edit as SetAttributes).attributesNS)
setAttrs.element instanceof Element &&
(isAttributesV2(setAttrs.attributes) ||
isAttributesNS(setAttrs.attributesNS))
);
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
},
"lint-staged": {
"*.ts": [
"eslint --fix --config package.json",
"eslint --fix",
"prettier --write",
"eslint --config package.json"
"eslint"
]
}
}