-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: render into dsd with a serialized attribute
- Loading branch information
1 parent
7c04cb3
commit 7b507d1
Showing
9 changed files
with
177 additions
and
3 deletions.
There are no files selected for viewing
8 changes: 7 additions & 1 deletion
8
integration/__fixtures__/server-express/dist_expected/server/server.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
integration/__fixtures__/server-express/dist_expected/server/server.js.map
Large diffs are not rendered by default.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
integration/__fixtures__/static-site/src/routes/01-assets/01-import-with-query-url.my-el.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { LitElement, html, css } from 'lit'; | ||
import { customElement, property, state } from 'lit/decorators.js'; | ||
|
||
import styles from './_00-import-with-query-url.scss?url'; | ||
|
||
@customElement('my-el') | ||
export class MyEl extends LitElement { | ||
static styles = [ | ||
css` | ||
:host { | ||
display: block; | ||
} | ||
`, | ||
]; | ||
|
||
@state() toggled = false; | ||
|
||
@property({ type: Array, converter: (s) => s?.split(',') }) | ||
'extra-styles': string[] | string | null = null; | ||
|
||
render() { | ||
if (typeof this['extra-styles'] === 'string') throw new Error(); | ||
|
||
return html` | ||
<!-- --> | ||
<link rel="stylesheet" href=${styles} /> | ||
${this['extra-styles']?.join(' --- ')} | ||
${this['extra-styles']?.map( | ||
(styleSheet) => html`<link rel="stylesheet" href=${styleSheet} />`, | ||
)} | ||
<div class="color-me-red">RED</div> | ||
<div class="color-me-green">GREEN</div> | ||
${this.toggled | ||
? html` <!-- --> | ||
<h2>elephant</h2> | ||
<div class="color-me-red">RED</div> | ||
<div class="color-me-green">GREEN</div> | ||
<button | ||
@click=${() => { | ||
this.toggled = false; | ||
console.log('elephant'); | ||
}} | ||
> | ||
CLICK ME | ||
</button>` | ||
: html` <!-- --> | ||
<h2>lion</h2> | ||
<div class="color-me-red">RED</div> | ||
<div class="color-me-green">GREEN</div> | ||
<button | ||
@click=${() => { | ||
this.toggled = true; | ||
console.log('lion'); | ||
}} | ||
> | ||
CLICK ME | ||
</button>`} | ||
`; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
integration/__fixtures__/static-site/src/routes/01-assets/01-import-with-query-url.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineRoute } from '@gracile/server/route'; | ||
import { html } from 'lit'; | ||
|
||
import { document } from '../../documents/document-with-assets.js'; | ||
|
||
import customStylesheet from './_00-import-with-query-url--server-2.scss?url'; | ||
import './01-import-with-query-url.my-el.js'; | ||
|
||
export default defineRoute({ | ||
document: (context) => document(context), | ||
|
||
template: (context) => html` | ||
<h1>Hello world</h1> | ||
<hr /> | ||
<code>${context.url.pathname}</code> | ||
<!-- FIXME: Why it's putting /@fs/ and not /src/ ? --> | ||
<my-el extra-styles=${[customStylesheet].toString()}></my-el> | ||
`, | ||
}); |
3 changes: 3 additions & 0 deletions
3
integration/__fixtures__/static-site/src/routes/01-assets/_01-import-with-query-url-2.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.color-me-red { | ||
background-color: red; | ||
} |
3 changes: 3 additions & 0 deletions
3
integration/__fixtures__/static-site/src/routes/01-assets/_01-import-with-query-url.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.color-me-green { | ||
background-color: green; | ||
} |
57 changes: 57 additions & 0 deletions
57
...ion/__fixtures__/static-site/src/routes/01-assets/_01-import-with-query-url_expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!doctype html> | ||
<html lang="en" data-path="/01-assets/01-import-with-query-url/"> | ||
<head> | ||
<script type="module" src="/@vite/client"></script> | ||
|
||
<meta charset="UTF-8" /> | ||
<title>Document - With sibling assets</title> | ||
|
||
<!-- PAGE ASSETS --> | ||
|
||
<!-- /PAGE ASSETS --> | ||
</head> | ||
|
||
<body> | ||
<!--lit-part bil8q8FGnEw=--> | ||
<h1>Hello world</h1> | ||
<hr /> | ||
<code | ||
><!--lit-part-->/01-assets/01-import-with-query-url/<!--/lit-part--></code | ||
> | ||
|
||
<!-- FIXME: Why it's putting /@fs/ and not /src/ ? --> | ||
<!--lit-node 5--><my-el | ||
extra-styles="/@fs/_00-import-with-query-url--server-2.scss" | ||
><template shadowroot="open" shadowrootmode="open" | ||
><style> | ||
:host { | ||
display: block; | ||
}</style | ||
><!--lit-part +EMEfM/KnnU=--> | ||
<!-- --> | ||
<!--lit-node 1--><link | ||
rel="stylesheet" | ||
href="/@fs/_00-import-with-query-url.scss" | ||
/> | ||
|
||
<!--lit-part-->/@fs/_00-import-with-query-url--server-2.scss<!--/lit-part--> | ||
<!--lit-part--><!--lit-part F3m906AMGI4=--><!--lit-node 0--><link | ||
rel="stylesheet" | ||
href="/@fs/_00-import-with-query-url--server-2.scss" | ||
/><!--/lit-part--><!--/lit-part--> | ||
|
||
<div class="color-me-red">RED</div> | ||
<div class="color-me-green">GREEN</div> | ||
|
||
<!--lit-part lUxCii3QuuI=--> | ||
<!-- --> | ||
<h2>lion</h2> | ||
|
||
<!--lit-node 2--><button>CLICK ME</button | ||
><!--/lit-part--> | ||
<!--/lit-part--></template | ||
></my-el | ||
> | ||
<!--/lit-part--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters