Skip to content

Commit d1e7fd3

Browse files
committed
fix: selectAll should not select disabled
1 parent ab79264 commit d1e7fd3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/composables/useOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ export default function useOptions (props, context, dep)
523523
return
524524
}
525525

526-
select(fo.value)
526+
select(fo.value.filter(o => !o.disabled))
527527
}
528528

529529
// no export

tests/unit/composables/useOptions.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,24 @@ describe('useOptions', () => {
15231523

15241524
expect(getValue(select)).toStrictEqual([1,2,3])
15251525
})
1526+
1527+
it('should only select non-disabled options', async () => {
1528+
let select = createSelect({
1529+
mode: 'tags',
1530+
options: [
1531+
{ label: 1, value: 1, },
1532+
{ label: 2, value: 2, disabled: true, },
1533+
{ label: 3, value: 3, },
1534+
],
1535+
value: [],
1536+
})
1537+
1538+
select.vm.selectAll()
1539+
1540+
await nextTick()
1541+
1542+
expect(getValue(select)).toStrictEqual([1,3])
1543+
})
15261544
})
15271545

15281546
describe('isSelected', () => {

0 commit comments

Comments
 (0)