diff --git a/src/components/fields/Checkbox/index.ts b/src/components/fields/Checkbox/index.ts index 16927a3..6300a5d 100644 --- a/src/components/fields/Checkbox/index.ts +++ b/src/components/fields/Checkbox/index.ts @@ -197,8 +197,8 @@ class CheckBox extends FormComponentBase { .pConn=${this.thePConn} ?disabled=${this.bReadonly} label=${this.caption} - value=${this.value} ?checked=${this.isChecked} + value=${this.value} testId=${this.testId} > @@ -215,26 +215,22 @@ class CheckBox extends FormComponentBase { listOfCheckboxes.push(label); listSourceItems.forEach((element, index) => { const multiChecked = this.selectedvalues?.some?.(data => data[dataField] === element.key); - const content = multiChecked - ? html` - data[dataField] === element.key) }} - @blur=${this.fieldOnBlur} @change=${this.handleChangeMultiMode}> - ${element.text ?? element.value} - - ` - : html` - data[dataField] === element.key) }} - @blur=${this.fieldOnBlur} @change=${this.handleChangeMultiMode}> - ${element.text ?? element.value} - - `; + const content = html` + data[dataField] === element.key) + }} + @blur=${this.fieldOnBlur} + @change=${this.handleChangeMultiMode} + > + ${element.text ?? element.value} + + `; listOfCheckboxes.push(content); }); const labelEnd = html``; @@ -244,40 +240,21 @@ class CheckBox extends FormComponentBase { const theContent = html` ${this.bVisible ? html`
${bHideLabel === true ? nothing : html`${this.label}`} - ${this.isChecked - ? html` - ${this.caption} - ` - : html` - - ${this.caption} - - `} + ${html` + ${this.caption} + `}
` : nothing}`; this.renderTemplates.push(theContent); diff --git a/tests/e2e/DigV2/ComplexFields/DataReference.spec.js b/tests/e2e/DigV2/ComplexFields/DataReference.spec.js index 3525aa9..d05138a 100644 --- a/tests/e2e/DigV2/ComplexFields/DataReference.spec.js +++ b/tests/e2e/DigV2/ComplexFields/DataReference.spec.js @@ -155,6 +155,24 @@ test.describe('E2E test', () => { await page.locator('button:has-text("Previous")').click(); + /** MultiSelect mode type test */ + await page.selectOption('lion-select[datatestid="9463d5f18a8924b3200b56efaad63bda"] select', 'Mode'); + + await page.selectOption('lion-select[datatestid="6f64b45d01d11d8efd1693dfcb63b735"] select', 'MultiSelect'); + + /** Checkbox group mode type test */ + await page.selectOption('lion-select[datatestid="4aa668349e0970901aa6b11528f95223"] select', 'Checkbox group'); + + await page.check('lion-checkbox[datatestid="5817eb8c-b1c7-449b-b323-705ca25734b4"] input'); + await page.check('lion-checkbox[datatestid="660a4217-d193-4c12-b8b4-193ee8441f86"] input'); + + await page.locator('button:has-text("Next")').click(); + + await expect(assignment.locator('td:has-text("Washing Machine")')).toBeVisible(); + await expect(assignment.locator('td:has-text("Mobile")')).toBeVisible(); + + await page.locator('button:has-text("Previous")').click(); + /** Readonly mode type test */ await page.selectOption('lion-select[datatestid="9463d5f18a8924b3200b56efaad63bda"] select', 'Mode');