mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-20 10:06:54 +03:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cadf6574b9 | ||
|
|
a45750d2c4 | ||
|
|
9953435dda |
@@ -495,6 +495,7 @@ re!(
|
|||||||
format!("border(?:Left|Right){WS}*[:=]{WS}*[\"'`]({D}+)px{WS}+solid")
|
format!("border(?:Left|Right){WS}*[:=]{WS}*[\"'`]({D}+)px{WS}+solid")
|
||||||
);
|
);
|
||||||
re!(BORDER_ACCENT_TW_RE, format!("{B}border-[tb]-({D}+){B}"));
|
re!(BORDER_ACCENT_TW_RE, format!("{B}border-[tb]-({D}+){B}"));
|
||||||
|
re!(ANIMATE_SPIN_RE, format!("{B}animate-spin{B}"));
|
||||||
re!(
|
re!(
|
||||||
BORDER_ACCENT_CSS_RE,
|
BORDER_ACCENT_CSS_RE,
|
||||||
format!(
|
format!(
|
||||||
@@ -867,7 +868,12 @@ pub static REGEX_MATCHERS: Lazy<Vec<Matcher>> = Lazy::new(|| {
|
|||||||
Matcher {
|
Matcher {
|
||||||
id: "border-accent-on-rounded",
|
id: "border-accent-on-rounded",
|
||||||
find_all: |l| all(&BORDER_ACCENT_TW_RE, l),
|
find_all: |l| all(&BORDER_ACCENT_TW_RE, l),
|
||||||
test: |m, line| has_rounded(line) && num(m.g(1)) >= 1.0,
|
test: |m, line| {
|
||||||
|
let scope = containing_markup_tag(line)(m.index);
|
||||||
|
has_rounded(&scope)
|
||||||
|
&& num(m.g(1)) >= 1.0
|
||||||
|
&& !ANIMATE_SPIN_RE.is_match(&scope)
|
||||||
|
},
|
||||||
fmt: |m, _| m.whole().to_string(),
|
fmt: |m, _| m.whole().to_string(),
|
||||||
},
|
},
|
||||||
Matcher {
|
Matcher {
|
||||||
@@ -1457,6 +1463,27 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn border_accent_skips_tailwind_spinner() {
|
||||||
|
let g = |line: &str| run("border-accent-on-rounded", line);
|
||||||
|
assert_eq!(
|
||||||
|
g(r#"<div className="rounded-lg border-t-4 border-blue-500" />"#),
|
||||||
|
vec!["border-t-4"]
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
g(r#"<div className="rounded-full border-b-2" />"#),
|
||||||
|
vec!["border-b-2"]
|
||||||
|
);
|
||||||
|
assert!(g(r#"<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-accent" />"#).is_empty());
|
||||||
|
assert!(g(r#"<div className="sm:animate-spin rounded-full h-8 w-8 border-t-2" />"#).is_empty());
|
||||||
|
assert!(g(r#"<div className="motion-safe:animate-spin rounded-full border-b-2" />"#).is_empty());
|
||||||
|
assert_eq!(
|
||||||
|
g(r#"<div className="animate-spin rounded-full h-12 w-12 border-b-2" /><div className="rounded-lg border-t-4" />"#),
|
||||||
|
vec!["border-t-4"]
|
||||||
|
);
|
||||||
|
assert!(g(r#"<div className="animate-spin rounded-full h-12 w-12 border-b-2" /><div className="border-t-4" />"#).is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn dashes() {
|
fn dashes() {
|
||||||
assert_eq!(count_em_dashes("a — b -- c ---d"), 2);
|
assert_eq!(count_em_dashes("a — b -- c ---d"), 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user