test_candidate_extraction() — tailwindcss Function Reference
Architecture documentation for the test_candidate_extraction() function in candidate_machine.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 6191d02c_c6f7_4b5d_48c4_e1b562cf65e2["test_candidate_extraction()"] add7fb68_668d_acbb_2d68_5b2963b9c0e4["candidate_machine.rs"] 6191d02c_c6f7_4b5d_48c4_e1b562cf65e2 -->|defined in| add7fb68_668d_acbb_2d68_5b2963b9c0e4 style 6191d02c_c6f7_4b5d_48c4_e1b562cf65e2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/extractor/candidate_machine.rs lines 201–317
fn test_candidate_extraction() {
for (input, expected) in [
// Simple utility
("flex", vec!["flex"]),
// Simple utility with special character(s)
("@container", vec!["@container"]),
// Single character utility
("a", vec!["a"]),
// Simple utility with dashes
("items-center", vec!["items-center"]),
// Simple utility with numbers
("px-2.5", vec!["px-2.5"]),
// Simple variant with simple utility
("hover:flex", vec!["hover:flex"]),
// Arbitrary properties
("[color:red]", vec!["[color:red]"]),
("![color:red]", vec!["![color:red]"]),
("[color:red]!", vec!["[color:red]!"]),
("[color:red]/20", vec!["[color:red]/20"]),
("![color:red]/20", vec!["![color:red]/20"]),
("[color:red]/20!", vec!["[color:red]/20!"]),
// With multiple variants
("hover:focus:flex", vec!["hover:focus:flex"]),
// Exceptions:
//
// Keys inside of a JS object could be a variant-less candidate. Vue example.
("{ underline: true }", vec!["underline", "true"]),
// With complex variants
(
"[&>[data-slot=icon]:last-child]:right-2.5",
vec!["[&>[data-slot=icon]:last-child]:right-2.5"],
),
// With multiple (complex) variants
(
"[&>[data-slot=icon]:last-child]:sm:right-2.5",
vec!["[&>[data-slot=icon]:last-child]:sm:right-2.5"],
),
(
"sm:[&>[data-slot=icon]:last-child]:right-2.5",
vec!["sm:[&>[data-slot=icon]:last-child]:right-2.5"],
),
// Exceptions regarding boundaries
//
// `flex!` is valid, but since it's followed by a non-boundary character it's invalid.
// `block` is therefore also invalid because it didn't start after a boundary.
("flex!block", vec![]),
] {
for (wrapper, additional) in [
// No wrapper
("{}", vec![]),
// With leading spaces
(" {}", vec![]),
(" {}", vec![]),
(" {}", vec![]),
// With trailing spaces
("{} ", vec![]),
("{} ", vec![]),
("{} ", vec![]),
// Surrounded by spaces
(" {} ", vec![]),
// Inside a string
("'{}'", vec![]),
// Inside a function call
("fn('{}')", vec![]),
// Inside nested function calls
("fn1(fn2('{}'))", vec![]),
// --------------------------
//
// HTML
// Inside a class (on its own)
(r#"<div class="{}"></div>"#, vec!["class"]),
// Inside a class (first)
(r#"<div class="{} foo"></div>"#, vec!["class", "foo"]),
// Inside a class (second)
(r#"<div class="foo {}"></div>"#, vec!["class", "foo"]),
// Inside a class (surrounded)
(
r#"<div class="foo {} bar"></div>"#,
vec!["class", "foo", "bar"],
),
// --------------------------
Domain
Subdomains
Source
Frequently Asked Questions
What does test_candidate_extraction() do?
test_candidate_extraction() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/candidate_machine.rs.
Where is test_candidate_extraction() defined?
test_candidate_extraction() is defined in crates/oxide/src/extractor/candidate_machine.rs at line 201.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free