@@ -1022,21 +1022,18 @@ describe("SettingsPage", () => {
10221022 renderSettingsPage ( store ) ;
10231023 fireEvent . click ( screen . getByRole ( "button" , { name : "外观" } ) ) ;
10241024
1025- const themePicker = await screen . findByRole ( "combobox " , { name : "主题" } ) ;
1025+ const themePicker = await screen . findByRole ( "button " , { name : "主题 Mint 深色 " } ) ;
10261026 const chineseLanguagePill = screen . getByRole ( "button" , { name : "中文" } ) ;
10271027
10281028 expect ( themePicker ) . toHaveAccessibleDescription ( "选择应用主题" ) ;
1029- expect ( screen . getByRole ( "option" , { name : "Mint 深色" } ) ) . toBeInTheDocument ( ) ;
1030- expect ( screen . getByRole ( "option" , { name : "Mint 浅色" } ) ) . toBeInTheDocument ( ) ;
1031- expect ( screen . getByRole ( "option" , { name : "高对比深色" } ) ) . toBeInTheDocument ( ) ;
10321029 expect (
10331030 screen . getByRole ( "group" , {
10341031 name : "语言" ,
10351032 } )
10361033 ) . toHaveAccessibleDescription ( "选择界面语言" ) ;
10371034 expect ( screen . queryByRole ( "group" , { name : "终端渲染器" } ) ) . not . toBeInTheDocument ( ) ;
10381035 expect ( screen . queryByRole ( "switch" , { name : "选中自动复制" } ) ) . not . toBeInTheDocument ( ) ;
1039- expect ( themePicker ) . toHaveValue ( "mint-dark ") ;
1036+ expect ( themePicker ) . toHaveAttribute ( "aria-haspopup" , "listbox ") ;
10401037 expect ( chineseLanguagePill ) . toHaveAttribute ( "aria-pressed" , "true" ) ;
10411038 } ) ;
10421039
@@ -1115,13 +1112,21 @@ describe("SettingsPage", () => {
11151112 renderSettingsPage ( store ) ;
11161113 fireEvent . click ( screen . getByRole ( "button" , { name : "Appearance" } ) ) ;
11171114
1118- const picker = await screen . findByRole ( "combobox" , { name : "Theme" } ) ;
1119- expect ( screen . getByRole ( "option" , { name : "Mint Dark" } ) ) . toBeInTheDocument ( ) ;
1120- expect ( screen . getByRole ( "option" , { name : "Graphite Dark" } ) ) . toBeInTheDocument ( ) ;
1121- expect ( screen . getByRole ( "option" , { name : "Graphite Light" } ) ) . toBeInTheDocument ( ) ;
1122- expect ( screen . getByRole ( "option" , { name : "Nord Light" } ) ) . toBeInTheDocument ( ) ;
1115+ const picker = await screen . findByRole ( "button" , { name : "Theme Mint Dark" } ) ;
1116+ expect ( picker ) . toHaveAttribute ( "aria-haspopup" , "listbox" ) ;
11231117
1124- fireEvent . change ( picker , { target : { value : "graphite-dark" } } ) ;
1118+ fireEvent . click ( picker ) ;
1119+
1120+ const listbox = await screen . findByRole ( "listbox" , { name : "Theme" } ) ;
1121+ expect ( within ( listbox ) . getByRole ( "option" , { name : "Mint Dark" } ) ) . toHaveAttribute (
1122+ "aria-selected" ,
1123+ "true"
1124+ ) ;
1125+ expect ( within ( listbox ) . getByRole ( "option" , { name : "Graphite Dark" } ) ) . toBeInTheDocument ( ) ;
1126+ expect ( within ( listbox ) . getByRole ( "option" , { name : "Graphite Light" } ) ) . toBeInTheDocument ( ) ;
1127+ expect ( within ( listbox ) . getByRole ( "option" , { name : "Nord Light" } ) ) . toBeInTheDocument ( ) ;
1128+
1129+ fireEvent . click ( within ( listbox ) . getByRole ( "option" , { name : "Graphite Dark" } ) ) ;
11251130
11261131 await waitFor ( ( ) => {
11271132 expect ( sendCommand ) . toHaveBeenCalledWith (
@@ -1139,7 +1144,11 @@ describe("SettingsPage", () => {
11391144
11401145 expect ( document . documentElement ) . toHaveAttribute ( "data-theme" , "graphite-dark" ) ;
11411146
1142- fireEvent . change ( picker , { target : { value : "graphite-light" } } ) ;
1147+ const updatedPicker = screen . getByRole ( "button" , { name : "Theme Graphite Dark" } ) ;
1148+ fireEvent . click ( updatedPicker ) ;
1149+
1150+ const updatedListbox = await screen . findByRole ( "listbox" , { name : "Theme" } ) ;
1151+ fireEvent . click ( within ( updatedListbox ) . getByRole ( "option" , { name : "Graphite Light" } ) ) ;
11431152
11441153 await waitFor ( ( ) => {
11451154 expect ( sendCommand ) . toHaveBeenCalledWith (
@@ -1156,7 +1165,7 @@ describe("SettingsPage", () => {
11561165 } ) ;
11571166
11581167 expect ( document . documentElement ) . toHaveAttribute ( "data-theme" , "graphite-light" ) ;
1159- expect ( picker ) . toHaveValue ( "graphite-light" ) ;
1168+ expect ( screen . getByRole ( "button" , { name : "Theme Graphite Light" } ) ) . toBeInTheDocument ( ) ;
11601169 } ) ;
11611170
11621171 it ( "hydrates the single theme picker from settings.get themeId" , async ( ) => {
@@ -1175,7 +1184,7 @@ describe("SettingsPage", () => {
11751184 fireEvent . click ( screen . getByRole ( "button" , { name : "Appearance" } ) ) ;
11761185
11771186 await waitFor ( ( ) => {
1178- expect ( screen . getByRole ( "combobox " , { name : "Theme" } ) ) . toHaveValue ( "nord-light" ) ;
1187+ expect ( screen . getByRole ( "button " , { name : "Theme Nord Light " } ) ) . toBeInTheDocument ( ) ;
11791188 } ) ;
11801189 } ) ;
11811190
@@ -1195,7 +1204,7 @@ describe("SettingsPage", () => {
11951204 fireEvent . click ( screen . getByRole ( "button" , { name : "Appearance" } ) ) ;
11961205
11971206 await waitFor ( ( ) => {
1198- expect ( screen . getByRole ( "combobox " , { name : "Theme" } ) ) . toHaveValue ( "mint-light" ) ;
1207+ expect ( screen . getByRole ( "button " , { name : "Theme Mint Light " } ) ) . toBeInTheDocument ( ) ;
11991208 expect ( document . documentElement ) . toHaveAttribute ( "data-theme" , "mint-light" ) ;
12001209 } ) ;
12011210 } ) ;
@@ -1216,7 +1225,7 @@ describe("SettingsPage", () => {
12161225 fireEvent . click ( screen . getByRole ( "button" , { name : "Appearance" } ) ) ;
12171226
12181227 await waitFor ( ( ) => {
1219- expect ( screen . getByRole ( "combobox " , { name : "Theme" } ) ) . toHaveValue ( "graphite-light" ) ;
1228+ expect ( screen . getByRole ( "button " , { name : "Theme Graphite Light " } ) ) . toBeInTheDocument ( ) ;
12201229 expect ( document . documentElement ) . toHaveAttribute ( "data-theme" , "graphite-light" ) ;
12211230 } ) ;
12221231 } ) ;
@@ -1237,9 +1246,12 @@ describe("SettingsPage", () => {
12371246
12381247 renderSettingsPage ( store ) ;
12391248 fireEvent . click ( screen . getByRole ( "button" , { name : "Appearance" } ) ) ;
1240- fireEvent . change ( await screen . findByRole ( "combobox" , { name : "Theme" } ) , {
1241- target : { value : "graphite-dark" } ,
1242- } ) ;
1249+ fireEvent . click ( await screen . findByRole ( "button" , { name : "Theme Mint Dark" } ) ) ;
1250+ fireEvent . click (
1251+ within ( await screen . findByRole ( "listbox" , { name : "Theme" } ) ) . getByRole ( "option" , {
1252+ name : "Graphite Dark" ,
1253+ } )
1254+ ) ;
12431255
12441256 await waitFor ( ( ) => {
12451257 expect ( sendCommand ) . toHaveBeenCalledWith (
@@ -1262,7 +1274,7 @@ describe("SettingsPage", () => {
12621274 await settingsGetPromise ;
12631275 } ) ;
12641276
1265- expect ( screen . getByRole ( "combobox " , { name : "Theme" } ) ) . toHaveValue ( "graphite-dark" ) ;
1277+ expect ( screen . getByRole ( "button " , { name : "Theme Graphite Dark " } ) ) . toBeInTheDocument ( ) ;
12661278 expect ( document . documentElement ) . toHaveAttribute ( "data-theme" , "graphite-dark" ) ;
12671279 } ) ;
12681280
0 commit comments