Skip to content

Commit

Permalink
test: nested html relative path (/^\w/)
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed May 12, 2022
1 parent 69c66ea commit 6288a39
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions playground/html/__tests__/html.spec.ts
Expand Up @@ -228,3 +228,8 @@ describe.runIf(isServe)('invalid', () => {
expect(content).toBeTruthy()
})
})

test('relative path in html asset', async () => {
expect(await page.textContent('.relative-js')).toMatch('hello')
expect(await getColor('.relative-css')).toMatch('red')
})
4 changes: 4 additions & 0 deletions playground/html/nested/asset/main.js
@@ -0,0 +1,4 @@
function text(el, text) {
document.querySelector(el).textContent = text
}
text('.relative-js', 'hello')
3 changes: 3 additions & 0 deletions playground/html/nested/asset/style.css
@@ -0,0 +1,3 @@
.relative-css {
color: red;
}
10 changes: 8 additions & 2 deletions playground/html/nested/index.html
@@ -1,3 +1,9 @@
<link rel="stylesheet" href="nested.css" />
<link rel="stylesheet" href="./nested.css" />
<h1>Nested</h1>
<script type="module" src="nested.js"></script>
<script type="module" src="./nested.js"></script>

<h1>no base path nested</h1>
<link rel="stylesheet" href="asset/style.css" />
<div class="relative-css">link style</div>
<div class="relative-js"></div>
<script src="asset/main.js" type="module"></script>

0 comments on commit 6288a39

Please sign in to comment.