File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
packages/component/component/table/__tests__ Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -798,4 +798,29 @@ describe("LayTable", () => {
798
798
expect ( thS [ 0 ] . text ( ) ) . toBe ( 'titleSlot1' )
799
799
expect ( thS [ 1 ] . text ( ) ) . toBe ( 'titleSlot2' )
800
800
} ) ;
801
+
802
+ test ( "dataSource为空,表头checkbox状态应为空" , async ( ) => {
803
+ const columns = [
804
+ { type : 'checkbox' , title : 'title' , key : 'id' } ,
805
+ ] ;
806
+
807
+ const dataSource = ref ( [ ] ) ;
808
+
809
+ const wrapper = mount ( {
810
+ setup ( ) {
811
+ return ( ) => (
812
+ < LayTable
813
+ columns = { columns }
814
+ dataSource = { dataSource . value }
815
+ > </ LayTable >
816
+ ) ;
817
+ } ,
818
+ } ) ;
819
+
820
+ await nextTick ( )
821
+
822
+ const checkboxComponent = wrapper . findComponent ( ".layui-table-header .layui-table-header-wrapper tr th .layui-checkbox" ) ;
823
+
824
+ expect ( ( checkboxComponent as any ) . vm . modelValue ) . toBeFalsy ( ) ;
825
+ } ) ;
801
826
} ) ;
You can’t perform that action at this time.
0 commit comments