@@ -22,10 +22,12 @@ import {
22
22
createEventTimePropValuesAsserter ,
23
23
findAll ,
24
24
getElementXY ,
25
+ isElementFocused ,
25
26
newProgrammaticE2EPage ,
26
27
skipAnimations ,
27
28
} from "../../tests/utils" ;
28
29
import { DEBOUNCE } from "../../utils/resources" ;
30
+ import { ComponentTestTokens , themed } from "../../tests/commonTests/themed" ;
29
31
import { CSS } from "./resources" ;
30
32
import { Combobox } from "./combobox" ;
31
33
@@ -1869,14 +1871,10 @@ describe("calcite-combobox", () => {
1869
1871
await page . waitForChanges ( ) ;
1870
1872
1871
1873
await element . press ( "ArrowLeft" ) ;
1872
- expect ( chips [ 0 ] ) . not . toHaveClass ( "chip--active" ) ;
1873
- expect ( chips [ 1 ] ) . not . toHaveClass ( "chip--active" ) ;
1874
- expect ( chips [ 2 ] ) . toHaveClass ( "chip--active" ) ;
1874
+ expect ( await isElementFocused ( page , `calcite-chip[data-test-id="chip-2"]` , { shadowed : true } ) ) . toBe ( true ) ;
1875
1875
1876
1876
await element . press ( "ArrowLeft" ) ;
1877
- expect ( chips [ 0 ] ) . not . toHaveClass ( "chip--active" ) ;
1878
- expect ( chips [ 1 ] ) . toHaveClass ( "chip--active" ) ;
1879
- expect ( chips [ 2 ] ) . not . toHaveClass ( "chip--active" ) ;
1877
+ expect ( await isElementFocused ( page , `calcite-chip[data-test-id="chip-1"]` , { shadowed : true } ) ) . toBe ( true ) ;
1880
1878
1881
1879
await element . press ( "Delete" ) ;
1882
1880
chips = await findAll ( page , "#myCombobox >>> calcite-chip" ) ;
@@ -2976,4 +2974,106 @@ describe("calcite-combobox", () => {
2976
2974
const combobox = await page . find ( "calcite-combobox" ) ;
2977
2975
expect ( ( await combobox . getProperty ( "selectedItems" ) ) . length ) . toBe ( 1 ) ;
2978
2976
} ) ;
2977
+
2978
+ describe ( "theme" , ( ) => {
2979
+ describe ( "default" , ( ) => {
2980
+ const comboboxHTML = html `< calcite-combobox label ="test " max-items ="6 " open >
2981
+ < calcite-combobox-item-group value ="Trees " label ="Trees ">
2982
+ < calcite-combobox-item value ="Pine " text-label ="Pine ">
2983
+ < calcite-combobox-item value ="Pine Nested " text-label ="Pine Nested "> </ calcite-combobox-item >
2984
+ </ calcite-combobox-item >
2985
+ </ calcite-combobox-item-group >
2986
+ < calcite-combobox-item value ="Sequoia " disabled text-label ="Sequoia "> </ calcite-combobox-item >
2987
+ < calcite-combobox-item value ="Douglas Fir " text-label ="Douglas Fir " selected > </ calcite-combobox-item >
2988
+ </ calcite-combobox > ` ;
2989
+
2990
+ const comboboxTokens : ComponentTestTokens = {
2991
+ "--calcite-combobox-input-height" : {
2992
+ shadowSelector : `.${ CSS . input } ` ,
2993
+ selector : "calcite-combobox" ,
2994
+ targetProp : "height" ,
2995
+ } ,
2996
+ "--calcite-combobox-input-background-color" : {
2997
+ shadowSelector : `.${ CSS . wrapper } ` ,
2998
+ selector : "calcite-combobox" ,
2999
+ targetProp : "backgroundColor" ,
3000
+ } ,
3001
+ "--calcite-combobox-input-border-color" : {
3002
+ shadowSelector : `.${ CSS . wrapper } ` ,
3003
+ selector : "calcite-combobox" ,
3004
+ targetProp : "borderColor" ,
3005
+ } ,
3006
+ "--calcite-combobox-input-text-color" : {
3007
+ shadowSelector : `.${ CSS . wrapper } ` ,
3008
+ selector : "calcite-combobox" ,
3009
+ targetProp : "color" ,
3010
+ } ,
3011
+ "--calcite-combobox-icon-color" : {
3012
+ shadowSelector : `.${ CSS . icon } ` ,
3013
+ selector : "calcite-combobox" ,
3014
+ targetProp : "color" ,
3015
+ } ,
3016
+ "--calcite-combobox-icon-color-hover" : {
3017
+ shadowSelector : `.${ CSS . icon } ` ,
3018
+ selector : "calcite-combobox" ,
3019
+ targetProp : "color" ,
3020
+ state : "hover" ,
3021
+ } ,
3022
+ "--calcite-combobox-background-color" : {
3023
+ shadowSelector : `.${ CSS . listContainer } ` ,
3024
+ selector : "calcite-combobox" ,
3025
+ targetProp : "backgroundColor" ,
3026
+ } ,
3027
+ "--calcite-combobox-item-group-text-color" : {
3028
+ selector : "calcite-combobox-item-group" ,
3029
+ shadowSelector : ".title" ,
3030
+ targetProp : "color" ,
3031
+ } ,
3032
+ "--calcite-combobox-item-group-border-color" : {
3033
+ selector : "calcite-combobox-item-group" ,
3034
+ shadowSelector : ".title" ,
3035
+ targetProp : "borderBottomColor" ,
3036
+ } ,
3037
+ } ;
3038
+ themed ( comboboxHTML , comboboxTokens ) ;
3039
+ } ) ;
3040
+
3041
+ describe ( "placeholder icon" , ( ) => {
3042
+ const comboboxWithPlaceHolderIconHTML = html ` < calcite-combobox
3043
+ label ="test "
3044
+ placeholder ="select element "
3045
+ placeholder-icon ="layers "
3046
+ >
3047
+ < calcite-combobox-item value ="Trees " text-label ="Trees "> </ calcite-combobox-item >
3048
+ < calcite-combobox-item value ="Sequoia " disabled text-label ="Sequoia "> </ calcite-combobox-item >
3049
+ < calcite-combobox-item value ="Douglas Fir " text-label ="Douglas Fir "> </ calcite-combobox-item >
3050
+ </ calcite-combobox > ` ;
3051
+
3052
+ const comboboxTokens : ComponentTestTokens = {
3053
+ "--calcite-combobox-icon-color" : {
3054
+ shadowSelector : `.${ CSS . placeholderIcon } ` ,
3055
+ selector : "calcite-combobox" ,
3056
+ targetProp : "color" ,
3057
+ } ,
3058
+ } ;
3059
+ themed ( comboboxWithPlaceHolderIconHTML , comboboxTokens ) ;
3060
+ } ) ;
3061
+
3062
+ describe ( "single select" , ( ) => {
3063
+ const singleSelectComboboxHTML = html ` < calcite-combobox label ="test " selection-mode ="single ">
3064
+ < calcite-combobox-item value ="Trees " text-label ="Trees "> </ calcite-combobox-item >
3065
+ < calcite-combobox-item value ="Sequoia " disabled text-label ="Sequoia "> </ calcite-combobox-item >
3066
+ < calcite-combobox-item value ="Douglas Fir " text-label ="Douglas Fir " selected > </ calcite-combobox-item >
3067
+ </ calcite-combobox > ` ;
3068
+
3069
+ const comboboxTokens : ComponentTestTokens = {
3070
+ "--calcite-combobox-input-text-color" : {
3071
+ shadowSelector : `.${ CSS . wrapper } ` ,
3072
+ selector : "calcite-combobox" ,
3073
+ targetProp : "color" ,
3074
+ } ,
3075
+ } ;
3076
+ themed ( singleSelectComboboxHTML , comboboxTokens ) ;
3077
+ } ) ;
3078
+ } ) ;
2979
3079
} ) ;
0 commit comments