File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
packages/devextreme-vue/src/core Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -82,4 +82,28 @@ describe('two-way binding', () => {
8282 expect ( component . element . classList . toString ( ) ) . toBe ( 'custom2 dx-show-invalid-badge dx-textbox dx-texteditor dx-editor-outlined dx-texteditor-empty dx-widget' ) ;
8383 } ) ;
8484 } ) ;
85+
86+ it ( 'dxClass should be set when class attr is undefined' , async ( ) => {
87+ expect . assertions ( 1 ) ;
88+ const vm = defineComponent ( {
89+ template :
90+ `<dx-text-box id="component" :class="{custom: customClass}"></dx-text-box>
91+ ` ,
92+ components : {
93+ DxTextBox,
94+ } ,
95+ props : {
96+ customClass : {
97+ type : String ,
98+ default : true ,
99+ } ,
100+ } ,
101+ } ) ;
102+ const wrapper = mount ( vm ) ;
103+ const component = wrapper . getComponent ( '#component' ) ;
104+ await wrapper . setProps ( { customClass : false } ) ;
105+ await nextTick ( ( ) => {
106+ expect ( component . element . classList . toString ( ) ) . toBe ( ' dx-show-invalid-badge dx-textbox dx-texteditor dx-editor-outlined dx-texteditor-empty dx-widget' ) ;
107+ } ) ;
108+ } ) ;
85109} ) ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ function getAttrs(attrs, dxClasses: string[]) {
5454 const attributes = { } ;
5555 includeAttrs . forEach ( ( attr ) => {
5656 const attrValue = attrs [ attr ] ;
57- if ( attrValue ) {
57+ if ( attrValue !== undefined && attrValue !== null ) {
5858 attributes [ attr ] = attr === 'class' && dxClasses . length ? `${ attrValue } ${ dxClasses . join ( ' ' ) } ` : attrValue ;
5959 }
6060 } ) ;
You can’t perform that action at this time.
0 commit comments