add failing tests
I noticed that some of the tests were failing, and while looking at
them, it happened because the tests were structured like this:
```html
<div
class="
backdrop-filter
backdrop-filter-none
backdrop-blur-lg
backdrop-brightness-50
backdrop-contrast-0
backdrop-grayscale
backdrop-hue-rotate-90
backdrop-invert
backdrop-opacity-75
backdrop-saturate-150
backdrop-sepia
"
></div>
```
This means that the class names themselves eventually end up like this: `backdrop-filter-none\n`
-> (Notice the `\n`)
/cc @thecrypticace
This commit is contained in:
parent
0c211a8bd0
commit
cceb585777
1 changed files with 43 additions and 0 deletions
|
|
@ -564,6 +564,49 @@ mod test {
|
|||
assert_eq!(candidates, vec!["content-['hello_[_]_world']"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_should_ignore_leading_spaces() {
|
||||
let candidates = run(" backdrop-filter-none", false);
|
||||
assert_eq!(candidates, vec!["backdrop-filter-none"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_should_ignore_trailing_spaces() {
|
||||
let candidates = run("backdrop-filter-none ", false);
|
||||
assert_eq!(candidates, vec!["backdrop-filter-none"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_should_keep_classes_before_an_ending_newline() {
|
||||
let candidates = run("backdrop-filter-none\n", false);
|
||||
assert_eq!(candidates, vec!["backdrop-filter-none"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_should_parse_out_the_correct_classes_from_tailwind_tests() {
|
||||
// From: tests/arbitrary-variants.test.js
|
||||
let candidates = run(
|
||||
r#"
|
||||
<div class="dark:lg:hover:[&>*]:underline"></div>
|
||||
|
||||
<div class="[&_.foo\_\_bar]:hover:underline"></div>
|
||||
<div class="hover:[&_.foo\_\_bar]:underline"></div>
|
||||
"#,
|
||||
false,
|
||||
);
|
||||
// TODO: it should not include additional (separate) classes: class, hover:, foo: bar, underline
|
||||
// TODO: Double check the expectations based on above information
|
||||
assert_eq!(
|
||||
candidates,
|
||||
vec![
|
||||
"class",
|
||||
r#"dark:lg:hover:[&>*]:underline"#,
|
||||
r#"[&_.foo\_\_bar]:hover:underline"#,
|
||||
r#"hover:[&_.foo\_\_bar]:underline"#
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn potential_candidates_are_skipped_when_hitting_impossible_characters() {
|
||||
let candidates = run(" <p class=\"text-sm text-blue-700\">A new software update is available. See what’s new in version 2.0.4.</p>", false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue