Skip to content

Commit

Permalink
test: add test for indented <style> tag
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Aug 25, 2024
1 parent 69bd6b3 commit f753b70
Show file tree
Hide file tree
Showing 5 changed files with 255 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dprint_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ dprint-plugin-biome = "0.0"
dprint-plugin-json = { version = "0.19", features = ["wasm"] }
dprint-plugin-typescript = { version = "0.91", features = ["wasm"] }
insta = { version = "1.38", features = ["glob"] }
malva = { version = "0.9", features = ["config_serde"] }
malva = { version = "0.10", features = ["config_serde"] }
similar-asserts = "1.5"
85 changes: 85 additions & 0 deletions dprint_plugin/tests/integration/biome/style.html.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
source: dprint_plugin/tests/integration.rs
---
<body>
<style>
/* journal entry styling. (maybe there's a better way than global styling?) */
article {
display: grid;
grid-template-columns: auto min(70ch, 100%) auto;
gap: 0;
margin: 1em;
}

article > * {
grid-column: 2;
}

/* todo: is there a better width to use? */
@media (min-width: 65em) {
/* todo: should images be fullbleed too? (they're in p tags meaning they need :has)
(should code even be fullbleed to begin with?) */

/* article > pre {
grid-column: 1 / 4;
width: 70%;
margin-left: auto;
margin-right: auto;
} */
}

/* margins! */
article * {
margin: 0;
}

article * + * {
margin-top: 1em;
}

article h2 + h3,
article h3 + h4,
article h4 + h5,
article h5 + h6 {
margin-top: 0;
}

article li + li {
margin-top: 0;
}

article p + ol,
article p + ul /*,
article p + pre */ {
margin-top: 0.5em;
}

/* nested lists */
article li > ul,
article li > ol {
margin-top: 0;
}

/* protect against dreaded horizontal scrollbar */
article img {
max-width: 100%;
}

/* general type features */
article h2 a,
article h3 a,
article h4 a,
article h5 a,
article h6 a {
display: none;
}

article h2:hover a,
article h3:hover a,
article h4:hover a,
article h5:hover a,
article h6:hover a {
display: inline;
}
</style>
</body>
85 changes: 85 additions & 0 deletions dprint_plugin/tests/integration/dprint_ts/style.html.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
source: dprint_plugin/tests/integration.rs
---
<body>
<style>
/* journal entry styling. (maybe there's a better way than global styling?) */
article {
display: grid;
grid-template-columns: auto min(70ch, 100%) auto;
gap: 0;
margin: 1em;
}

article > * {
grid-column: 2;
}

/* todo: is there a better width to use? */
@media (min-width: 65em) {
/* todo: should images be fullbleed too? (they're in p tags meaning they need :has)
(should code even be fullbleed to begin with?) */

/* article > pre {
grid-column: 1 / 4;
width: 70%;
margin-left: auto;
margin-right: auto;
} */
}

/* margins! */
article * {
margin: 0;
}

article * + * {
margin-top: 1em;
}

article h2 + h3,
article h3 + h4,
article h4 + h5,
article h5 + h6 {
margin-top: 0;
}

article li + li {
margin-top: 0;
}

article p + ol,
article p + ul /*,
article p + pre */ {
margin-top: 0.5em;
}

/* nested lists */
article li > ul,
article li > ol {
margin-top: 0;
}

/* protect against dreaded horizontal scrollbar */
article img {
max-width: 100%;
}

/* general type features */
article h2 a,
article h3 a,
article h4 a,
article h5 a,
article h6 a {
display: none;
}

article h2:hover a,
article h3:hover a,
article h4:hover a,
article h5:hover a,
article h6:hover a {
display: inline;
}
</style>
</body>
82 changes: 82 additions & 0 deletions dprint_plugin/tests/integration/style.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<body>
<style>
/* journal entry styling. (maybe there's a better way than global styling?) */
article {
display: grid;
grid-template-columns: auto min(70ch, 100%) auto;
gap: 0;
margin: 1em;
}

article > * {
grid-column: 2;
}

/* todo: is there a better width to use? */
@media (min-width: 65em) {
/* todo: should images be fullbleed too? (they're in p tags meaning they need :has)
(should code even be fullbleed to begin with?) */

/* article > pre {
grid-column: 1 / 4;
width: 70%;
margin-left: auto;
margin-right: auto;
} */
}

/* margins! */
article * {
margin: 0;
}

article * + * {
margin-top: 1em;
}

article h2 + h3,
article h3 + h4,
article h4 + h5,
article h5 + h6 {
margin-top: 0;
}

article li + li {
margin-top: 0;
}

article p + ol,
article p + ul/*,
article p + pre */ {
margin-top: 0.5em;
}

/* nested lists */
article li > ul,
article li > ol {
margin-top: 0;
}

/* protect against dreaded horizontal scrollbar */
article img {
max-width: 100%;
}

/* general type features */
article h2 a,
article h3 a,
article h4 a,
article h5 a,
article h6 a {
display: none;
}

article h2:hover a,
article h3:hover a,
article h4:hover a,
article h5:hover a,
article h6:hover a {
display: inline;
}
</style>
</body>

0 comments on commit f753b70

Please sign in to comment.