From d7ec16b1556e2f1c842cb9096885a8b93c0e264c Mon Sep 17 00:00:00 2001 From: Aleksandr Chaplinskii Date: Tue, 22 Jul 2025 17:03:43 +0200 Subject: [PATCH] fix(datatable): make headercheckboxicon work again --- .../primevue/src/datatable/DataTable.spec.js | 64 +++++++++++++++++++ .../primevue/src/datatable/HeaderCheckbox.vue | 4 +- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/packages/primevue/src/datatable/DataTable.spec.js b/packages/primevue/src/datatable/DataTable.spec.js index 1dd5401108..05238c03f1 100644 --- a/packages/primevue/src/datatable/DataTable.spec.js +++ b/packages/primevue/src/datatable/DataTable.spec.js @@ -1439,4 +1439,68 @@ describe('DataTable.vue', () => { // contextmenu // row styling + it('should render custom headercheckboxicon slot in Column', () => { + wrapper = mount(DataTable, { + global: { + plugins: [PrimeVue], + components: { + Column + } + }, + props: { + value: smallData, + selection: null + }, + slots: { + default: ` + + + + + + ` + } + }); + + const headerCheckboxIcon = wrapper.find('.custom-header-checkbox-icon'); + + expect(headerCheckboxIcon.exists()).toBe(true); + expect(headerCheckboxIcon.text()).toBe('CustomIcon'); + }); + + it('should render custom rowcheckboxicon slot in Column', () => { + wrapper = mount(DataTable, { + global: { + plugins: [PrimeVue], + components: { + Column + } + }, + props: { + value: smallData, + selection: null + }, + slots: { + default: ` + + + + + + ` + } + }); + + // custom-row-checkbox-icon should be rendered in each row, so 3 times + const rowCheckboxIcons = wrapper.findAll('.custom-row-checkbox-icon'); + + expect(rowCheckboxIcons.length).toBe(3); + expect(rowCheckboxIcons[0].text()).toBe('CustomIcon'); + expect(rowCheckboxIcons[1].text()).toBe('CustomIcon'); + expect(rowCheckboxIcons[2].text()).toBe('CustomIcon'); + }); }); diff --git a/packages/primevue/src/datatable/HeaderCheckbox.vue b/packages/primevue/src/datatable/HeaderCheckbox.vue index b50da5c58b..87e3494c6e 100755 --- a/packages/primevue/src/datatable/HeaderCheckbox.vue +++ b/packages/primevue/src/datatable/HeaderCheckbox.vue @@ -1,9 +1,9 @@