diff --git a/specs/t27f/vf_storybook.t27 b/specs/t27f/vf_storybook.t27 index 6bc6b57443..58516ecab8 100644 --- a/specs/t27f/vf_storybook.t27 +++ b/specs/t27f/vf_storybook.t27 @@ -28,8 +28,6 @@ use t27f::ui_kit::kit_input; use t27f::ui_kit::kit_badge; use t27f::ui_kit::kit_nav; use t27f::ui_kit::kit_table; -use t27f::ui_kit::kit_text; -use t27f::ui_kit::kit_container; use t27f::ui_kit::kit_node_count; use t27f::ui_kit::kit_state_at; use t27f::ui_kit::kit_variant_at; @@ -48,7 +46,7 @@ use t27f::vf_layout::vf_layout; use t27f::vf_pixel::vf_overflow_count; use t27f::vf_meaning::vf_primary_action; -pub const SB_COUNT : u32 = 35; +pub const SB_COUNT : u32 = 32; pub const SB_MIN : u32 = 31; pub const SB_MAX : u32 = 39; @@ -60,15 +58,13 @@ pub const SC_BADGE : u32 = 3; pub const SC_NAV : u32 = 4; pub const SC_TABLE : u32 = 5; pub const SC_TASK : u32 = 6; -pub const SC_TEXT : u32 = 7; -pub const SC_CONTAINER : u32 = 8; -pub const SC_COUNT : u32 = 9; +pub const SC_COUNT : u32 = 7; -pub const SB_COMPONENTS : [9]str = ["card", "button", "input", "badge", "nav", "table", "task-card", "text", "container"]; +pub const SB_COMPONENTS : [7]str = ["card", "button", "input", "badge", "nav", "table", "task-card"]; ; the components ui_kit has a constructor for, written out by hand so the catalog can be checked against it -pub const SB_KIT_COUNT : u32 = 8; -pub const SB_KIT_COMPONENTS : [8]str = ["card", "button", "input", "badge", "nav", "table", "text", "container"]; +pub const SB_KIT_COUNT : u32 = 6; +pub const SB_KIT_COMPONENTS : [6]str = ["card", "button", "input", "badge", "nav", "table"]; pub const SB_WIDTHS : [3]u32 = [375, 768, 1280]; @@ -83,7 +79,7 @@ pub const SB_BTN_STATES : [3]u32 = [0, 1, 3]; ; story i: stories 0..14 are the buttons, variant-major (primary, secondary, ghost, success, warn) times default, hover, disabled ; 15..16 card default and hover, 17..19 input default, error, focus, 20..24 badge by variant, 25..27 nav by active item ; 28..29 table of 1 and 2 rows, 30 the task card, 31 input disabled (appended last so that no earlier index moves) -pub const SB_IDS : [35]str = [ +pub const SB_IDS : [32]str = [ "button-primary-default", "button-primary-hover", "button-primary-disabled", "button-secondary-default", "button-secondary-hover", "button-secondary-disabled", "button-ghost-default", "button-ghost-hover", "button-ghost-disabled", @@ -96,11 +92,9 @@ pub const SB_IDS : [35]str = [ "table-1-row", "table-2-rows", "task-card", "input-disabled", - "text-heading", "text-body", - "container-row", ]; -pub const SB_TITLES : [35]str = [ +pub const SB_TITLES : [32]str = [ "Button / Primary / Default", "Button / Primary / Hover", "Button / Primary / Disabled", "Button / Secondary / Default", "Button / Secondary / Hover", "Button / Secondary / Disabled", "Button / Ghost / Default", "Button / Ghost / Hover", "Button / Ghost / Disabled", @@ -113,12 +107,10 @@ pub const SB_TITLES : [35]str = [ "Table / 1 row", "Table / 2 rows", "Task card", "Input / Disabled", - "Text / Heading", "Text / Body", - "Container / Row", ]; -; component index per story: 1 button, 0 card, 2 input, 3 badge, 4 nav, 5 table, 6 task card, 7 text, 8 container -pub const SB_COMP : [35]u32 = [ +; component index per story: 1 button, 0 card, 2 input, 3 badge, 4 nav, 5 table, 6 task card +pub const SB_COMP : [32]u32 = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 2, 2, @@ -127,12 +119,10 @@ pub const SB_COMP : [35]u32 = [ 5, 5, 6, 2, - 7, 7, - 8, ]; -; the variant slot is the first ui_kit argument: KV_* for button, card and badge, the active item for nav, the row count for table, KV_* for text, dir for container -pub const SB_VARIANT : [35]u32 = [ +; the variant slot is the first ui_kit argument: KV_* for button, card and badge, the active item for nav, the row count for table +pub const SB_VARIANT : [32]u32 = [ 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0, 0, 0, @@ -141,12 +131,10 @@ pub const SB_VARIANT : [35]u32 = [ 1, 2, 0, 0, - 0, 1, - 0, ]; -; the state slot is the second ui_kit argument: KS_* for button, card and input, unused for badge, nav, table, task card, text and container -pub const SB_STATE : [35]u32 = [ +; the state slot is the second ui_kit argument: KS_* for button, card and input, unused for badge, nav, table and the task card +pub const SB_STATE : [32]u32 = [ 0, 1, 3, 0, 1, 3, 0, 1, 3, 0, 1, 3, 0, 1, 3, 0, 1, 0, 4, 5, @@ -155,19 +143,15 @@ pub const SB_STATE : [35]u32 = [ 0, 0, 0, 3, - 0, 0, - 0, ]; ; every kit story must pass bits 0..4; the task card must also keep exactly one primary action, bit 5 -pub const SB_CHECKS : [35]u32 = [ +pub const SB_CHECKS : [32]u32 = [ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 63, 31, - 31, 31, - 31, ]; pub fn sb_count() -> u32 { @@ -264,12 +248,6 @@ pub fn sb_kit(i: u32) -> UiKit { if c == SC_TABLE { return kit_table(v); } - if c == SC_TEXT { - return kit_text(v); - } - if c == SC_CONTAINER { - return kit_container(v); - } return sb_task_kit(); } @@ -312,12 +290,6 @@ pub fn sb_expected_nodes_for(comp: u32, variant: u32, state: u32) -> u32 { if comp == SC_TASK { return 8; } - if comp == SC_TEXT { - return 1; - } - if comp == SC_CONTAINER { - return 1; - } return 0; } @@ -371,7 +343,7 @@ pub fn sb_parents_first_all() -> bool { } ; ids must be non-empty and pairwise different -pub fn sb_ids_unique_in(ids: [35]str) -> bool { +pub fn sb_ids_unique_in(ids: [32]str) -> bool { var a : u32 = 0; while a < SB_COUNT { let ia : str = ids[a]; @@ -394,7 +366,7 @@ pub fn sb_ids_unique_in(ids: [35]str) -> bool { } pub fn sb_all_ids_unique() -> bool { - var ids : [35]str = SB_IDS; + var ids : [32]str = SB_IDS; return sb_ids_unique_in(ids); } @@ -428,7 +400,7 @@ pub fn sb_stories_of(component: str) -> u32 { } ; how many of the listed component names have no story at all -pub fn sb_uncovered_in(names: [9]str) -> u32 { +pub fn sb_uncovered_in(names: [7]str) -> u32 { var bad : u32 = 0; var c : u32 = 0; while c < SC_COUNT { @@ -443,7 +415,7 @@ pub fn sb_uncovered_in(names: [9]str) -> u32 { } ; how many ui_kit components are missing from the listed catalog names -pub fn sb_kit_missing_in(names: [9]str) -> u32 { +pub fn sb_kit_missing_in(names: [7]str) -> u32 { var miss : u32 = 0; var k : u32 = 0; while k < SB_KIT_COUNT { @@ -467,7 +439,7 @@ pub fn sb_kit_missing_in(names: [9]str) -> u32 { } pub fn sb_coverage_ok() -> bool { - var cats : [9]str = SB_COMPONENTS; + var cats : [7]str = SB_COMPONENTS; let u : u32 = sb_uncovered_in(cats); let m : u32 = sb_kit_missing_in(cats); if u != 0 { @@ -737,7 +709,7 @@ pub fn sb_promise_gaps() -> u32 { } test count_within_bounds { - assert sb_count() == 35; + assert sb_count() == 32; assert sb_count_in_bounds(sb_count()); assert sb_count_in_bounds(31); assert sb_count_in_bounds(39); @@ -775,7 +747,6 @@ test story_slots_and_names { let c30 : str = sb_component(30); let c31 : str = sb_component(31); let c32 : str = sb_component(32); - let c35 : str = sb_component(35); let c99 : str = sb_component(99); assert c0 == "button"; assert c15 == "card"; @@ -785,20 +756,17 @@ test story_slots_and_names { assert c28 == "table"; assert c30 == "task-card"; assert c31 == "input"; - assert c32 == "text"; - assert c35 == ""; + assert c32 == ""; assert c99 == ""; let id0 : str = sb_id(0); let id30 : str = sb_id(30); let id31 : str = sb_id(31); let id32 : str = sb_id(32); - let id35 : str = sb_id(35); let id99 : str = sb_id(99); assert id0 == "button-primary-default"; assert id30 == "task-card"; assert id31 == "input-disabled"; - assert id32 == "text-heading"; - assert id35 == ""; + assert id32 == ""; assert id99 == ""; let t31 : str = sb_title(31); assert t31 == "Input / Disabled"; @@ -823,22 +791,22 @@ test stories_use_the_kit_slots { test ids_unique { assert sb_all_ids_unique(); - var dup : [35]str = SB_IDS; + var dup : [32]str = SB_IDS; let first : str = dup[2]; dup[5] = first; assert sb_ids_unique_in(dup) == false; - var last : [35]str = SB_IDS; + var last : [32]str = SB_IDS; let head : str = last[0]; last[31] = head; assert sb_ids_unique_in(last) == false; - var prev : [35]str = SB_IDS; + var prev : [32]str = SB_IDS; let mid : str = prev[17]; prev[31] = mid; assert sb_ids_unique_in(prev) == false; - var empty : [35]str = SB_IDS; + var empty : [32]str = SB_IDS; empty[9] = ""; assert sb_ids_unique_in(empty) == false; - var clean : [35]str = SB_IDS; + var clean : [32]str = SB_IDS; assert sb_ids_unique_in(clean); } @@ -858,10 +826,7 @@ test node_count_equals_the_kit { assert sb_node_count(31) == 3; assert sb_node_count(31) == sb_node_count(17); assert sb_node_count(31) != sb_node_count(18); - assert sb_node_count(32) == 1; - assert sb_node_count(33) == 1; - assert sb_node_count(34) == 1; - assert sb_node_count(35) == 0; + assert sb_node_count(32) == 0; assert sb_node_count(99) == 0; assert sb_node_count(18) != sb_expected_nodes_for(2, 0, KS_DEFAULT); assert sb_node_count(18) == sb_expected_nodes_for(2, 0, KS_ERROR); @@ -919,17 +884,17 @@ test task_card_keeps_one_primary_action { test catalog_coverage { assert sb_coverage_ok(); - var cats : [9]str = SB_COMPONENTS; + var cats : [7]str = SB_COMPONENTS; assert sb_uncovered_in(cats) == 0; assert sb_kit_missing_in(cats) == 0; cats[3] = "tooltip"; assert sb_uncovered_in(cats) == 1; assert sb_kit_missing_in(cats) == 1; - var cats2 : [9]str = SB_COMPONENTS; + var cats2 : [7]str = SB_COMPONENTS; cats2[6] = ""; assert sb_uncovered_in(cats2) == 1; assert sb_kit_missing_in(cats2) == 0; - var cats3 : [9]str = SB_COMPONENTS; + var cats3 : [7]str = SB_COMPONENTS; cats3[1] = "toggle"; cats3[4] = "tabs"; assert sb_uncovered_in(cats3) == 2; @@ -942,8 +907,6 @@ test catalog_coverage { assert sb_stories_of("nav") == 3; assert sb_stories_of("table") == 2; assert sb_stories_of("task-card") == 1; - assert sb_stories_of("text") == 2; - assert sb_stories_of("container") == 1; assert sb_stories_of("tooltip") == 0; } @@ -976,11 +939,6 @@ test required_stories_exist { assert sb_has_story("table", 2, 0); assert sb_has_story("table", 3, 0) == false; assert sb_has_story("task-card", 0, 0); - assert sb_has_story("text", 0, 0); - assert sb_has_story("text", 1, 0); - assert sb_has_story("text", 2, 0) == false; - assert sb_has_story("container", 0, 0); - assert sb_has_story("container", 1, 0) == false; assert sb_has_story("tooltip", 0, 0) == false; } @@ -993,8 +951,6 @@ test states_covered_per_component { assert sb_states_covered("nav") == 2; assert sb_states_covered("table") == 1; assert sb_states_covered("task-card") == 1; - assert sb_states_covered("text") == 1; - assert sb_states_covered("container") == 1; assert sb_states_covered("tooltip") == 0; assert sb_states_covered("button") != sb_states_covered("card"); } @@ -1009,10 +965,7 @@ test widths_are_promised_and_met { assert sb_widths_ok(29); assert sb_widths_ok(30); assert sb_widths_ok(31); - assert sb_widths_ok(32); - assert sb_widths_ok(33); - assert sb_widths_ok(34); - assert sb_widths_ok(35) == false; + assert sb_widths_ok(32) == false; assert sb_widths_ok(99) == false; assert sb_promise_gaps() == 0; assert sb_base_missing(0) == 5;