| 1 | pub mod activity_panel; |
| 2 | pub mod adaptive_card; |
| 3 | pub mod attachment_tray; |
| 4 | pub mod attachments; |
| 5 | pub mod avatar; |
| 6 | pub mod call_control_fold; |
| 7 | pub mod call_controls; |
| 8 | pub mod call_extras; |
| 9 | pub mod call_health; |
| 10 | pub mod call_layouts; |
| 11 | pub mod call_mini; |
| 12 | pub mod call_mini_window; |
| 13 | pub mod call_organizer; |
| 14 | pub mod call_people; |
| 15 | pub mod call_pop_out; |
| 16 | pub mod call_record; |
| 17 | pub mod call_stage; |
| 18 | pub mod call_transcript; |
| 19 | pub mod call_view; |
| 20 | pub mod call_view_menu; |
| 21 | pub mod calls_tab; |
| 22 | pub mod card_carousel; |
| 23 | pub mod card_chart; |
| 24 | pub mod card_code_block; |
| 25 | pub mod card_icon; |
| 26 | pub mod card_input; |
| 27 | pub mod card_media; |
| 28 | pub mod card_table; |
| 29 | pub mod card_widgets; |
| 30 | pub mod channel_tabs; |
| 31 | pub mod composer; |
| 32 | pub mod conversation; |
| 33 | pub mod dialog_overlay; |
| 34 | pub mod draft_style; |
| 35 | pub mod emoji_popup; |
| 36 | pub mod format_toolbar; |
| 37 | pub mod forward_dialog; |
| 38 | pub mod fun_picker; |
| 39 | pub mod image_viewer; |
| 40 | pub mod join_dialog; |
| 41 | pub mod link_preview; |
| 42 | pub mod message_actions; |
| 43 | pub mod message_row; |
| 44 | pub mod new_chat; |
| 45 | pub mod new_meeting_dialog; |
| 46 | pub mod pin_banner; |
| 47 | pub mod post_card; |
| 48 | pub mod prejoin_view; |
| 49 | pub mod profile_card; |
| 50 | pub mod proposal_card; |
| 51 | pub mod rail; |
| 52 | pub mod reaction_picker; |
| 53 | pub mod reaction_pills; |
| 54 | pub mod reaction_proposal_pill; |
| 55 | pub mod recap_tab; |
| 56 | pub mod saved_panel; |
| 57 | pub mod scheduled_toolbar; |
| 58 | pub mod section_dialog; |
| 59 | pub mod share_bar; |
| 60 | pub mod shared_tab; |
| 61 | pub mod shell; |
| 62 | pub mod shortcuts; |
| 63 | pub mod shortcuts_dialog; |
| 64 | pub mod sidebar; |
| 65 | pub mod status_bar; |
| 66 | pub mod status_menu; |
| 67 | pub mod status_message_dialog; |
| 68 | pub mod switcher; |
| 69 | pub mod title_bar; |
| 70 | pub mod toolbar_placement; |
| 71 | pub mod transfer_picker; |
| 72 | pub mod translation_line; |
| 73 | pub mod widgets; |
| 74 | |
| 75 | #[cfg(test)] |
| 76 | mod tests { |
| 77 | use std::path::Path; |
| 78 | |
| 79 | fn rust_files(directory: &Path, files: &mut Vec<std::path::PathBuf>) { |
| 80 | for entry in std::fs::read_dir(directory).unwrap() { |
| 81 | let path = entry.unwrap().path(); |
| 82 | if path.is_dir() { |
| 83 | rust_files(&path, files); |
| 84 | } else if path.extension().is_some_and(|extension| extension == "rs") { |
| 85 | files.push(path); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | #[test] |
| 91 | fn hover_styles_never_toggle_display() { |
| 92 | let toggle = |
| 93 | regex::Regex::new(r"hover\([^|]*\|\w+\|\s*\w+\s*\.\s*(hidden|flex|block|grid)\(\)") |
| 94 | .unwrap(); |
| 95 | let mut files = Vec::new(); |
| 96 | rust_files( |
| 97 | &Path::new(env!("CARGO_MANIFEST_DIR")).join("src"), |
| 98 | &mut files, |
| 99 | ); |
| 100 | let offenders: Vec<String> = files |
| 101 | .iter() |
| 102 | .flat_map(|path| { |
| 103 | let source = std::fs::read_to_string(path).unwrap(); |
| 104 | source |
| 105 | .lines() |
| 106 | .enumerate() |
| 107 | .filter(|(_, line)| toggle.is_match(line)) |
| 108 | .map(|(index, _)| format!("{}:{}", path.display(), index + 1)) |
| 109 | .collect::<Vec<_>>() |
| 110 | }) |
| 111 | .collect(); |
| 112 | assert!( |
| 113 | offenders.is_empty(), |
| 114 | "hover styles must toggle visible()/invisible(), not display (gpui panics \"must call prepaint before paint\"): {offenders:?}" |
| 115 | ); |
| 116 | } |
| 117 | } |