Skip to content

Commit

Permalink
refactor: valid.html
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Aug 15, 2022
1 parent 2cd3f10 commit 81b4123
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ pnpm-lock.yaml
pnpm-workspace.yaml
playground/tsconfig-json-load-error/has-error/tsconfig.json
playground/html/invalid.html
playground/html/valid.html
playground/worker/classic-worker.js
7 changes: 7 additions & 0 deletions playground/html/__tests__/html.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,10 @@ describe.runIf(isServe)('invalid', () => {
expect(content).toBeTruthy()
})
})

describe('valid html', () => {
test('duplicated attrs', async () => {
await page.goto(viteTestUrl + '/valid.html')
expect(await getColor('#duplicated-attrs')).toBe('green')
})
})
10 changes: 0 additions & 10 deletions playground/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,3 @@ <h1>Hello</h1>
<link rel="icon" href="{{cdn_host}}/cdn/images/favicon.ico" />
<link rel="stylesheet" href="{{cdn_host}}/css.css" type="text/css" />
<script src="{{cdn_host}}/js.js"></script>

<!-- accepted HTML parsing errors, browsers accept these -->
<div foo="a" foo="b">Accept duplicated attribute</div>

<!-- accepted HTML constructs -->
<datalist>
<!-- prettier-ignore -->
<option value="option-without-closing-tag">
</datalist>
</datalist>
7 changes: 7 additions & 0 deletions playground/html/valid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- accepted HTML parsing errors, browsers accept these -->
<div id="duplicated-attrs" style="color: green;" style="color: red;">Accept duplicated attribute</div>

<!-- accepted HTML constructs -->
<datalist>
<option value="option-without-closing-tag">
</datalist>
3 changes: 2 additions & 1 deletion playground/html/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ module.exports = {
__dirname,
'unicode-path/中文-にほんご-한글-🌕🌖🌗/index.html'
),
linkProps: resolve(__dirname, 'link-props/index.html')
linkProps: resolve(__dirname, 'link-props/index.html'),
valid: resolve(__dirname, 'valid.html')
}
}
},
Expand Down

0 comments on commit 81b4123

Please sign in to comment.