@@ -2488,39 +2488,8 @@ fn element_spacer() {
2489// --- Badge element ---
2489// --- Badge element ---
2492−fn element_badge() {
2493− let output = compile("@page T\n@badge [background red, color white] 3");
2495− output.contains("<span"),
2496− "badge renders as span: {}",
2500− output.contains("border-radius:9999px"),
2501− "badge should be pill-shaped: {}",
2504− assert!(output.contains("3"), "badge content: {}", output);
2507// --- Tooltip element ---
2491// --- Tooltip element ---
2510−fn element_tooltip() {
2511− let output = compile("@page T\n@tooltip [tip Hover for info]\n @text Help");
2513− output.contains("title=\"Hover for info\""),
2514− "tooltip should have title attr: {}",
2518− output.contains("cursor:help"),
2519− "tooltip should have cursor:help: {}",
2524// --- @each step ---
2493// --- @each step ---
@@ -2695,7 +2664,7 @@ fn no_warning_direction_attr() {
2697fn no_warning_new_elements() {
2666fn no_warning_new_elements() {
2698− // Grid, stack, spacer, badge, tooltip should all parse without errors
2667+ // Grid and spacer parse without errors
2699 let diags = parse_diagnostics("@grid\n @text A");
2668 let diags = parse_diagnostics("@grid\n @text A");
2700 assert!(
2669 assert!(
@@ -2712,22 +2681,6 @@ fn no_warning_new_elements() {
2712 "spacer should parse, got: {:?}",
2681 "spacer should parse, got: {:?}",
2715− let diags = parse_diagnostics("@badge [background red] 5");
2719− .any(|d| d.severity == htmlang::parser::Severity::Error),
2720− "badge should parse, got: {:?}",
2723− let diags = parse_diagnostics("@tooltip Help text\n @text Hover");
2727− .any(|d| d.severity == htmlang::parser::Severity::Error),
2728− "tooltip should parse, got: {:?}",
2733// --- New feature tests ---
2686// --- New feature tests ---
@@ -2737,11 +2690,6 @@ fn snapshot_variable_filters() {
2737 snapshot_test("variable_filters");
2690 snapshot_test("variable_filters");
2741−fn snapshot_new_elements_5() {
2742− snapshot_test("new_elements_5");
2746fn snapshot_css_shorthands() {
2694fn snapshot_css_shorthands() {
2747 snapshot_test("css_shorthands");
2695 snapshot_test("css_shorthands");
@@ -2804,49 +2752,6 @@ fn test_variable_filters() {
2808−fn test_new_elements_parse() {
2810− let diags = parse_diagnostics("@avatar [width 48, height 48]\n @text AB");
2814− .any(|d| d.severity == htmlang::parser::Severity::Error),
2820− let diags = parse_diagnostics("@carousel [gap 16]\n @el Slide 1");
2824− .any(|d| d.severity == htmlang::parser::Severity::Error),
2830− let diags = parse_diagnostics("@chip [background #eee] Tag");
2834− .any(|d| d.severity == htmlang::parser::Severity::Error),
2840− let diags = parse_diagnostics("@tag [color blue] v1.0");
2844− .any(|d| d.severity == htmlang::parser::Severity::Error),
2851fn test_css_shorthands_output() {
2756fn test_css_shorthands_output() {
2852 let result = htmlang::parser::parse("@text [$truncate] Hello");
2757 let result = htmlang::parser::parse("@text [$truncate] Hello");
@@ -2885,27 +2790,6 @@ fn test_css_shorthands_output() {
2888− let result = htmlang::parser::parse("@el [$no-scrollbar] Content");
2889− let html = htmlang::codegen::generate(&result.document);
2891− html.contains("scrollbar-width:none"),
2892− "no-scrollbar should work, got: {}",
2896− let result = htmlang::parser::parse("@el [$skeleton, width 100, height 20] Content");
2897− let html = htmlang::codegen::generate(&result.document);
2899− html.contains("hl-skeleton"),
2900− "skeleton should add animation, got: {}",
2904− html.contains("@keyframes hl-skeleton"),
2905− "skeleton should add keyframes, got: {}",
2909 // `gradient` became plain CSS: the compiler points to the replacement.
2793 // `gradient` became plain CSS: the compiler points to the replacement.
2910 let result = htmlang::parser::parse("@el [gradient #fff #000] Content");
2794 let result = htmlang::parser::parse("@el [gradient #fff #000] Content");
2911 assert!(
2795 assert!(
@@ -2918,17 +2802,6 @@ fn test_css_shorthands_output() {
2922−fn test_carousel_children_snap() {
2923− let result = htmlang::parser::parse("@carousel\n @el A\n @el B");
2924− let html = htmlang::codegen::generate(&result.document);
2926− html.contains("scroll-snap-align:start"),
2927− "carousel children should have snap-align, got: {}",
2933fn test_import_missing_file() {
2806fn test_import_missing_file() {
2934 // We can't test @use with actual files in unit tests easily, but we can verify
2807 // We can't test @use with actual files in unit tests easily, but we can verify
@@ -3306,11 +3179,6 @@ fn snapshot_script_element() {
3306 snapshot_test("script_element");
3179 snapshot_test("script_element");
3310−fn snapshot_breadcrumb() {
3311− snapshot_test("breadcrumb");
3315fn snapshot_new_directives() {
3183fn snapshot_new_directives() {
3316 snapshot_test("new_directives");
3184 snapshot_test("new_directives");
@@ -3368,14 +3236,6 @@ fn search_element() {
3368 assert!(output.contains("<search>"), "search: {}", output);
3236 assert!(output.contains("<search>"), "search: {}", output);
3372−fn breadcrumb_generates_nav_ol() {
3373− let output = compile("@breadcrumb\n @li > @text Home\n @li About");
3374− assert!(output.contains("aria-label=\"breadcrumb\""), "nav: {}", output);
3375− assert!(output.contains("<ol class="), "ol: {}", output);
3376− assert!(output.contains("<li class="), "li: {}", output);
3380fn canonical_directive() {
3240fn canonical_directive() {
3381 let output = compile("@page [canonical https://example.com/page] T\n@text Hello");
3241 let output = compile("@page [canonical https://example.com/page] T\n@text Hello");
@@ -4819,13 +4679,12 @@ fn children_prefix_styles_direct_children() {
4821fn standard_library_components_compile_cleanly() {
4681fn standard_library_components_compile_cleanly() {
4822− let src = "@badge [background red] 3\n@tag v2\n@chip Rust\n@avatar\n AB\n@spacer\n@tooltip [tip More] Hover\n@carousel\n @el A\n@breadcrumb\n @li Home\n@el [$skeleton]\n@el [$no-scrollbar]";
4682+ let src = "@row\n @text A\n @spacer\n @text [$truncate] B";
4823 let diags = parse_diagnostics(src);
4683 let diags = parse_diagnostics(src);
4824 assert!(diags.is_empty(), "standard library produced diagnostics: {:?}", diags);
4684 assert!(diags.is_empty(), "standard library produced diagnostics: {:?}", diags);
4825 let output = compile(src);
4685 let output = compile(src);
4826− assert!(output.contains("<span class=\"a\">3</span>"), "{}", output);
4686+ assert!(output.contains("flex:1"), "{}", output);
4827− assert!(output.contains("title=\"More\""), "{}", output);
4828− assert!(output.contains("@keyframes hl-skeleton"), "{}", output);
4687+ assert!(output.contains("text-overflow:ellipsis"), "{}", output);