@gitlab/ui 101.16.0 → 102.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/constants.js +9 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.js +11 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/constants.js +9 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/utils.js +9 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +8 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +8 -0
- package/dist/components/experimental/duo/chat/constants.js +9 -0
- package/dist/components/experimental/duo/chat/duo_chat.js +8 -0
- package/dist/components/experimental/duo/chat/markdown_renderer.js +8 -1
- package/dist/components/experimental/duo/chat/mock_data.js +8 -0
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +8 -0
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +1 -0
- package/dist/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.js +8 -0
- package/dist/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.js +8 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/vendor/bootstrap-vue/src/components/button/button.js +0 -4
- package/dist/vendor/bootstrap-vue/src/components/collapse/collapse.js +1 -2
- package/dist/vendor/bootstrap-vue/src/components/nav/nav.js +6 -9
- package/dist/vendor/bootstrap-vue/src/components/tabs/tabs.js +6 -30
- package/dist/vendor/bootstrap-vue/src/constants/env.js +1 -10
- package/dist/vendor/bootstrap-vue/src/constants/key-codes.js +1 -2
- package/dist/vendor/bootstrap-vue/src/index.js +1 -11
- package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +2 -16
- package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check.js +14 -104
- package/dist/vendor/bootstrap-vue/src/utils/plugins.js +1 -41
- package/package.json +1 -1
- package/src/components/experimental/duo/chat/components/duo_chat_context/constants.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.vue +12 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.md +12 -3
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.md +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.md +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.scss +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/constants.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/utils.js +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.md +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.vue +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.md +9 -0
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue +9 -0
- package/src/components/experimental/duo/chat/constants.js +9 -0
- package/src/components/experimental/duo/chat/duo_chat.md +8 -0
- package/src/components/experimental/duo/chat/duo_chat.scss +9 -0
- package/src/components/experimental/duo/chat/duo_chat.vue +9 -0
- package/src/components/experimental/duo/chat/markdown_renderer.js +9 -0
- package/src/components/experimental/duo/chat/mock_data.js +9 -0
- package/src/components/experimental/duo/chat/variables.scss +9 -1
- package/src/components/experimental/duo/user_feedback/user_feedback.md +9 -0
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +9 -0
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +6 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md +9 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue +9 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.md +9 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue +9 -0
- package/src/vendor/bootstrap/scss/_reboot.scss +2 -5
- package/src/vendor/bootstrap-vue/src/components/button/MODIFICATIONS.md +16 -0
- package/src/vendor/bootstrap-vue/src/components/button/README.md +0 -39
- package/src/vendor/bootstrap-vue/src/components/button/button.js +0 -4
- package/src/vendor/bootstrap-vue/src/components/button/button.spec.js +0 -36
- package/src/vendor/bootstrap-vue/src/components/collapse/collapse.js +1 -1
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/README.md +3 -174
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox-group.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox.spec.js +0 -409
- package/src/vendor/bootstrap-vue/src/components/form-radio/README.md +0 -129
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.spec.js +0 -365
- package/src/vendor/bootstrap-vue/src/components/nav/README.md +0 -20
- package/src/vendor/bootstrap-vue/src/components/nav/nav.js +7 -9
- package/src/vendor/bootstrap-vue/src/components/nav/nav.spec.js +0 -67
- package/src/vendor/bootstrap-vue/src/components/tabs/README.md +45 -187
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +6 -29
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.spec.js +0 -58
- package/src/vendor/bootstrap-vue/src/constants/env.js +0 -14
- package/src/vendor/bootstrap-vue/src/constants/key-codes.js +0 -1
- package/src/vendor/bootstrap-vue/src/index.js +0 -17
- package/src/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +3 -20
- package/src/vendor/bootstrap-vue/src/mixins/form-radio-check.js +19 -114
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +0 -18
- package/src/vendor/bootstrap-vue/src/utils/plugins.js +0 -33
- package/dist/vendor/bootstrap-vue/src/browser.js +0 -8
- package/dist/vendor/bootstrap-vue/src/components/index.js +0 -11
- package/dist/vendor/bootstrap-vue/src/constants/classes.js +0 -3
- package/src/vendor/bootstrap-vue/src/browser.js +0 -9
- package/src/vendor/bootstrap-vue/src/components/index.js +0 -11
- package/src/vendor/bootstrap-vue/src/constants/classes.js +0 -1
|
@@ -406,230 +406,6 @@ describe('form-checkbox', () => {
|
|
|
406
406
|
wrapper.destroy()
|
|
407
407
|
})
|
|
408
408
|
|
|
409
|
-
// --- Plain styling ---
|
|
410
|
-
|
|
411
|
-
it('plain has structure <div><input><label></label></div>', async () => {
|
|
412
|
-
const wrapper = mount(BFormCheckbox, {
|
|
413
|
-
propsData: {
|
|
414
|
-
plain: true,
|
|
415
|
-
checked: '',
|
|
416
|
-
value: 'a'
|
|
417
|
-
},
|
|
418
|
-
slots: {
|
|
419
|
-
default: 'foobar'
|
|
420
|
-
}
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
expect(wrapper).toBeDefined()
|
|
424
|
-
expect(wrapper.element.tagName).toBe('DIV')
|
|
425
|
-
|
|
426
|
-
const $children = wrapper.element.children
|
|
427
|
-
expect($children.length).toEqual(2)
|
|
428
|
-
expect($children[0].tagName).toEqual('INPUT')
|
|
429
|
-
expect($children[1].tagName).toEqual('LABEL')
|
|
430
|
-
|
|
431
|
-
wrapper.destroy()
|
|
432
|
-
})
|
|
433
|
-
|
|
434
|
-
it('plain has wrapper class form-check', async () => {
|
|
435
|
-
const wrapper = mount(BFormCheckbox, {
|
|
436
|
-
propsData: {
|
|
437
|
-
plain: true,
|
|
438
|
-
checked: '',
|
|
439
|
-
value: 'a'
|
|
440
|
-
},
|
|
441
|
-
slots: {
|
|
442
|
-
default: 'foobar'
|
|
443
|
-
}
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
expect(wrapper.classes().length).toEqual(1)
|
|
447
|
-
expect(wrapper.classes()).toContain('form-check')
|
|
448
|
-
|
|
449
|
-
wrapper.destroy()
|
|
450
|
-
})
|
|
451
|
-
|
|
452
|
-
it('plain has input type checkbox', async () => {
|
|
453
|
-
const wrapper = mount(BFormCheckbox, {
|
|
454
|
-
propsData: {
|
|
455
|
-
plain: true,
|
|
456
|
-
checked: '',
|
|
457
|
-
value: 'a'
|
|
458
|
-
},
|
|
459
|
-
slots: {
|
|
460
|
-
default: 'foobar'
|
|
461
|
-
}
|
|
462
|
-
})
|
|
463
|
-
|
|
464
|
-
const $input = wrapper.find('input')
|
|
465
|
-
expect($input.attributes('type')).toBeDefined()
|
|
466
|
-
expect($input.attributes('type')).toEqual('checkbox')
|
|
467
|
-
|
|
468
|
-
wrapper.destroy()
|
|
469
|
-
})
|
|
470
|
-
|
|
471
|
-
it('plain has input class form-check-input', async () => {
|
|
472
|
-
const wrapper = mount(BFormCheckbox, {
|
|
473
|
-
propsData: {
|
|
474
|
-
plain: true,
|
|
475
|
-
checked: false
|
|
476
|
-
},
|
|
477
|
-
slots: {
|
|
478
|
-
default: 'foobar'
|
|
479
|
-
}
|
|
480
|
-
})
|
|
481
|
-
|
|
482
|
-
const $input = wrapper.find('input')
|
|
483
|
-
expect($input.classes().length).toEqual(1)
|
|
484
|
-
expect($input.classes()).toContain('form-check-input')
|
|
485
|
-
|
|
486
|
-
wrapper.destroy()
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
it('plain has label class form-check-label', async () => {
|
|
490
|
-
const wrapper = mount(BFormCheckbox, {
|
|
491
|
-
propsData: {
|
|
492
|
-
plain: true,
|
|
493
|
-
checked: false
|
|
494
|
-
},
|
|
495
|
-
slots: {
|
|
496
|
-
default: 'foobar'
|
|
497
|
-
}
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
const $label = wrapper.find('label')
|
|
501
|
-
expect($label.classes().length).toEqual(1)
|
|
502
|
-
expect($label.classes()).toContain('form-check-label')
|
|
503
|
-
|
|
504
|
-
wrapper.destroy()
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
it('plain has default slot content in label', async () => {
|
|
508
|
-
const wrapper = mount(BFormCheckbox, {
|
|
509
|
-
propsData: {
|
|
510
|
-
plain: true,
|
|
511
|
-
checked: false
|
|
512
|
-
},
|
|
513
|
-
slots: {
|
|
514
|
-
default: 'foobar'
|
|
515
|
-
}
|
|
516
|
-
})
|
|
517
|
-
|
|
518
|
-
const $label = wrapper.find('label')
|
|
519
|
-
expect($label.text()).toEqual('foobar')
|
|
520
|
-
|
|
521
|
-
wrapper.destroy()
|
|
522
|
-
})
|
|
523
|
-
|
|
524
|
-
it('plain does not have class position-static when label provided', async () => {
|
|
525
|
-
const wrapper = mount(BFormCheckbox, {
|
|
526
|
-
propsData: {
|
|
527
|
-
plain: true,
|
|
528
|
-
checked: false
|
|
529
|
-
},
|
|
530
|
-
slots: {
|
|
531
|
-
default: 'foobar'
|
|
532
|
-
}
|
|
533
|
-
})
|
|
534
|
-
|
|
535
|
-
expect(wrapper.find('input').classes()).not.toContain('position-static')
|
|
536
|
-
|
|
537
|
-
wrapper.destroy()
|
|
538
|
-
})
|
|
539
|
-
|
|
540
|
-
it('plain has no label when no default slot content', async () => {
|
|
541
|
-
const wrapper = mount(BFormCheckbox, {
|
|
542
|
-
propsData: {
|
|
543
|
-
plain: true,
|
|
544
|
-
checked: false
|
|
545
|
-
}
|
|
546
|
-
})
|
|
547
|
-
|
|
548
|
-
expect(wrapper.find('label').exists()).toBe(false)
|
|
549
|
-
expect(wrapper.find('input').classes()).toContain('position-static')
|
|
550
|
-
|
|
551
|
-
wrapper.destroy()
|
|
552
|
-
})
|
|
553
|
-
|
|
554
|
-
it('plain has no input validation classes by default', async () => {
|
|
555
|
-
const wrapper = mount(BFormCheckbox, {
|
|
556
|
-
propsData: {
|
|
557
|
-
plain: true,
|
|
558
|
-
checked: false
|
|
559
|
-
},
|
|
560
|
-
slots: {
|
|
561
|
-
default: 'foobar'
|
|
562
|
-
}
|
|
563
|
-
})
|
|
564
|
-
|
|
565
|
-
const $input = wrapper.find('input')
|
|
566
|
-
expect($input).toBeDefined()
|
|
567
|
-
expect($input.classes()).not.toContain('is-invalid')
|
|
568
|
-
expect($input.classes()).not.toContain('is-valid')
|
|
569
|
-
|
|
570
|
-
wrapper.destroy()
|
|
571
|
-
})
|
|
572
|
-
|
|
573
|
-
it('plain has no input validation classes when state=null', async () => {
|
|
574
|
-
const wrapper = mount(BFormCheckbox, {
|
|
575
|
-
propsData: {
|
|
576
|
-
state: null,
|
|
577
|
-
plain: true,
|
|
578
|
-
checked: false
|
|
579
|
-
},
|
|
580
|
-
slots: {
|
|
581
|
-
default: 'foobar'
|
|
582
|
-
}
|
|
583
|
-
})
|
|
584
|
-
|
|
585
|
-
const $input = wrapper.find('input')
|
|
586
|
-
expect($input).toBeDefined()
|
|
587
|
-
expect($input.classes()).not.toContain('is-invalid')
|
|
588
|
-
expect($input.classes()).not.toContain('is-valid')
|
|
589
|
-
|
|
590
|
-
wrapper.destroy()
|
|
591
|
-
})
|
|
592
|
-
|
|
593
|
-
it('plain has input validation class is-valid when state=true', async () => {
|
|
594
|
-
const wrapper = mount(BFormCheckbox, {
|
|
595
|
-
propsData: {
|
|
596
|
-
state: true,
|
|
597
|
-
plain: true,
|
|
598
|
-
checked: false
|
|
599
|
-
},
|
|
600
|
-
slots: {
|
|
601
|
-
default: 'foobar'
|
|
602
|
-
}
|
|
603
|
-
})
|
|
604
|
-
|
|
605
|
-
const $input = wrapper.find('input')
|
|
606
|
-
expect($input).toBeDefined()
|
|
607
|
-
expect($input.classes()).not.toContain('is-invalid')
|
|
608
|
-
expect($input.classes()).toContain('is-valid')
|
|
609
|
-
|
|
610
|
-
wrapper.destroy()
|
|
611
|
-
})
|
|
612
|
-
|
|
613
|
-
it('plain has input validation class is-invalid when state=false', async () => {
|
|
614
|
-
const wrapper = mount(BFormCheckbox, {
|
|
615
|
-
propsData: {
|
|
616
|
-
state: false,
|
|
617
|
-
plain: true,
|
|
618
|
-
checked: false
|
|
619
|
-
},
|
|
620
|
-
slots: {
|
|
621
|
-
default: 'foobar'
|
|
622
|
-
}
|
|
623
|
-
})
|
|
624
|
-
|
|
625
|
-
const $input = wrapper.find('input')
|
|
626
|
-
expect($input).toBeDefined()
|
|
627
|
-
expect($input.classes()).toContain('is-invalid')
|
|
628
|
-
expect($input.classes()).not.toContain('is-valid')
|
|
629
|
-
|
|
630
|
-
wrapper.destroy()
|
|
631
|
-
})
|
|
632
|
-
|
|
633
409
|
// --- Switch styling - stand alone ---
|
|
634
410
|
|
|
635
411
|
it('switch has structure <div><input><label></label></div>', async () => {
|
|
@@ -729,191 +505,6 @@ describe('form-checkbox', () => {
|
|
|
729
505
|
wrapper.destroy()
|
|
730
506
|
})
|
|
731
507
|
|
|
732
|
-
// --- Button styling - stand-alone mode ---
|
|
733
|
-
|
|
734
|
-
it('stand-alone button has structure <div><label><input></label></div>', async () => {
|
|
735
|
-
const wrapper = mount(BFormCheckbox, {
|
|
736
|
-
propsData: {
|
|
737
|
-
button: true,
|
|
738
|
-
checked: '',
|
|
739
|
-
value: 'a'
|
|
740
|
-
},
|
|
741
|
-
slots: {
|
|
742
|
-
default: 'foobar'
|
|
743
|
-
}
|
|
744
|
-
})
|
|
745
|
-
|
|
746
|
-
expect(wrapper).toBeDefined()
|
|
747
|
-
expect(wrapper.element.tagName).toBe('DIV')
|
|
748
|
-
|
|
749
|
-
const $labels = wrapper.element.children
|
|
750
|
-
expect($labels.length).toEqual(1)
|
|
751
|
-
expect($labels[0].tagName).toEqual('LABEL')
|
|
752
|
-
|
|
753
|
-
const $inputs = $labels[0].children
|
|
754
|
-
expect($inputs.length).toEqual(1)
|
|
755
|
-
expect($inputs[0].tagName).toEqual('INPUT')
|
|
756
|
-
|
|
757
|
-
wrapper.destroy()
|
|
758
|
-
})
|
|
759
|
-
|
|
760
|
-
it('stand-alone button has wrapper classes btn-group-toggle and d-inline-block', async () => {
|
|
761
|
-
const wrapper = mount(BFormCheckbox, {
|
|
762
|
-
propsData: {
|
|
763
|
-
button: true,
|
|
764
|
-
checked: '',
|
|
765
|
-
value: 'a'
|
|
766
|
-
},
|
|
767
|
-
slots: {
|
|
768
|
-
default: 'foobar'
|
|
769
|
-
}
|
|
770
|
-
})
|
|
771
|
-
|
|
772
|
-
expect(wrapper.classes().length).toEqual(2)
|
|
773
|
-
expect(wrapper.classes()).toContain('btn-group-toggle')
|
|
774
|
-
expect(wrapper.classes()).toContain('d-inline-block')
|
|
775
|
-
|
|
776
|
-
wrapper.destroy()
|
|
777
|
-
})
|
|
778
|
-
|
|
779
|
-
it('stand-alone button has label classes btn and btn-secondary when unchecked', async () => {
|
|
780
|
-
const wrapper = mount(BFormCheckbox, {
|
|
781
|
-
propsData: {
|
|
782
|
-
button: true,
|
|
783
|
-
checked: '',
|
|
784
|
-
value: 'a'
|
|
785
|
-
},
|
|
786
|
-
slots: {
|
|
787
|
-
default: 'foobar'
|
|
788
|
-
}
|
|
789
|
-
})
|
|
790
|
-
|
|
791
|
-
const $label = wrapper.find('label')
|
|
792
|
-
expect($label).toBeDefined()
|
|
793
|
-
expect($label.classes().length).toEqual(2)
|
|
794
|
-
expect($label.classes()).not.toContain('active')
|
|
795
|
-
expect($label.classes()).not.toContain('focus')
|
|
796
|
-
expect($label.classes()).toContain('btn')
|
|
797
|
-
expect($label.classes()).toContain('btn-secondary')
|
|
798
|
-
|
|
799
|
-
wrapper.destroy()
|
|
800
|
-
})
|
|
801
|
-
|
|
802
|
-
it('stand-alone button has label classes btn, btn-secondary and active when checked by default', async () => {
|
|
803
|
-
const wrapper = mount(BFormCheckbox, {
|
|
804
|
-
propsData: {
|
|
805
|
-
button: true,
|
|
806
|
-
checked: 'a',
|
|
807
|
-
value: 'a'
|
|
808
|
-
},
|
|
809
|
-
slots: {
|
|
810
|
-
default: 'foobar'
|
|
811
|
-
}
|
|
812
|
-
})
|
|
813
|
-
|
|
814
|
-
const $label = wrapper.find('label')
|
|
815
|
-
expect($label).toBeDefined()
|
|
816
|
-
expect($label.classes().length).toEqual(3)
|
|
817
|
-
expect($label.classes()).not.toContain('focus')
|
|
818
|
-
expect($label.classes()).toContain('btn')
|
|
819
|
-
expect($label.classes()).toContain('btn-secondary')
|
|
820
|
-
expect($label.classes()).toContain('active')
|
|
821
|
-
|
|
822
|
-
wrapper.destroy()
|
|
823
|
-
})
|
|
824
|
-
|
|
825
|
-
it('stand-alone button has label class active when clicked (checked)', async () => {
|
|
826
|
-
const wrapper = mount(BFormCheckbox, {
|
|
827
|
-
propsData: {
|
|
828
|
-
button: true,
|
|
829
|
-
checked: '',
|
|
830
|
-
value: 'a'
|
|
831
|
-
},
|
|
832
|
-
slots: {
|
|
833
|
-
default: 'foobar'
|
|
834
|
-
}
|
|
835
|
-
})
|
|
836
|
-
|
|
837
|
-
const $label = wrapper.find('label')
|
|
838
|
-
expect($label).toBeDefined()
|
|
839
|
-
|
|
840
|
-
const $input = wrapper.find('input')
|
|
841
|
-
expect($input).toBeDefined()
|
|
842
|
-
expect($label.classes().length).toEqual(2)
|
|
843
|
-
expect($label.classes()).not.toContain('focus')
|
|
844
|
-
expect($label.classes()).not.toContain('active')
|
|
845
|
-
expect($label.classes()).toContain('btn')
|
|
846
|
-
expect($label.classes()).toContain('btn-secondary')
|
|
847
|
-
|
|
848
|
-
await $input.setChecked(true)
|
|
849
|
-
expect($label.classes().length).toEqual(3)
|
|
850
|
-
expect($label.classes()).toContain('active')
|
|
851
|
-
expect($label.classes()).toContain('btn')
|
|
852
|
-
expect($label.classes()).toContain('btn-secondary')
|
|
853
|
-
|
|
854
|
-
wrapper.destroy()
|
|
855
|
-
})
|
|
856
|
-
|
|
857
|
-
it('stand-alone button has label class focus when input focused', async () => {
|
|
858
|
-
const wrapper = mount(BFormCheckbox, {
|
|
859
|
-
attachTo: document.body,
|
|
860
|
-
propsData: {
|
|
861
|
-
button: true,
|
|
862
|
-
checked: '',
|
|
863
|
-
value: 'a'
|
|
864
|
-
},
|
|
865
|
-
slots: {
|
|
866
|
-
default: 'foobar'
|
|
867
|
-
}
|
|
868
|
-
})
|
|
869
|
-
|
|
870
|
-
const $label = wrapper.find('label')
|
|
871
|
-
expect($label).toBeDefined()
|
|
872
|
-
|
|
873
|
-
const $input = wrapper.find('input')
|
|
874
|
-
expect($label.classes().length).toEqual(2)
|
|
875
|
-
expect($label.classes()).not.toContain('focus')
|
|
876
|
-
expect($label.classes()).not.toContain('active')
|
|
877
|
-
expect($label.classes()).toContain('btn')
|
|
878
|
-
expect($label.classes()).toContain('btn-secondary')
|
|
879
|
-
expect($input).toBeDefined()
|
|
880
|
-
|
|
881
|
-
await $input.trigger('focus')
|
|
882
|
-
expect($label.classes().length).toEqual(3)
|
|
883
|
-
expect($label.classes()).toContain('focus')
|
|
884
|
-
|
|
885
|
-
await $input.trigger('blur')
|
|
886
|
-
expect($label.classes().length).toEqual(2)
|
|
887
|
-
expect($label.classes()).not.toContain('focus')
|
|
888
|
-
|
|
889
|
-
wrapper.destroy()
|
|
890
|
-
})
|
|
891
|
-
|
|
892
|
-
it('stand-alone button has label btn-primary when prop btn-variant set to primary', async () => {
|
|
893
|
-
const wrapper = mount(BFormCheckbox, {
|
|
894
|
-
propsData: {
|
|
895
|
-
button: true,
|
|
896
|
-
buttonVariant: 'primary',
|
|
897
|
-
checked: '',
|
|
898
|
-
value: 'a'
|
|
899
|
-
},
|
|
900
|
-
slots: {
|
|
901
|
-
default: 'foobar'
|
|
902
|
-
}
|
|
903
|
-
})
|
|
904
|
-
|
|
905
|
-
const $label = wrapper.find('label')
|
|
906
|
-
expect($label).toBeDefined()
|
|
907
|
-
expect($label.classes().length).toEqual(2)
|
|
908
|
-
expect($label.classes()).not.toContain('focus')
|
|
909
|
-
expect($label.classes()).not.toContain('active')
|
|
910
|
-
expect($label.classes()).not.toContain('btn-secondary')
|
|
911
|
-
expect($label.classes()).toContain('btn')
|
|
912
|
-
expect($label.classes()).toContain('btn-primary')
|
|
913
|
-
|
|
914
|
-
wrapper.destroy()
|
|
915
|
-
})
|
|
916
|
-
|
|
917
508
|
// --- Indeterminate testing ---
|
|
918
509
|
|
|
919
510
|
it('does not have input indeterminate set by default', async () => {
|
|
@@ -341,133 +341,6 @@ Sizes can be set on individual `<b-form-radio>` components, or inherited from th
|
|
|
341
341
|
**Note:** Bootstrap v4.x does not natively support sizes for the custom radio control. However,
|
|
342
342
|
BootstrapVue includes custom SCSS/CSS that adds support for sizing the custom radios.
|
|
343
343
|
|
|
344
|
-
## Button style radios
|
|
345
|
-
|
|
346
|
-
Render radios with the look of buttons by setting the prop `buttons` to `true` on
|
|
347
|
-
`<b-form-radio-group>`. Set the button variant by setting the `button-variant` prop to one of the
|
|
348
|
-
standard Bootstrap button variants (see [`<gl-button>`](?path=/docs/base-button--docs) for supported
|
|
349
|
-
variants). The default `button-variant` is `secondary`.
|
|
350
|
-
|
|
351
|
-
The `buttons` prop has precedence over `plain`, and `button-variant` has no effect if `buttons` is
|
|
352
|
-
not set.
|
|
353
|
-
|
|
354
|
-
Button style radios will have the class `.active` automatically applied to their label when they are
|
|
355
|
-
in the checked state.
|
|
356
|
-
|
|
357
|
-
```html
|
|
358
|
-
<template>
|
|
359
|
-
<div>
|
|
360
|
-
<b-form-group label="Button style radios" v-slot="{ ariaDescribedby }">
|
|
361
|
-
<b-form-radio-group
|
|
362
|
-
id="btn-radios-1"
|
|
363
|
-
v-model="selected"
|
|
364
|
-
:options="options"
|
|
365
|
-
:aria-describedby="ariaDescribedby"
|
|
366
|
-
name="radios-btn-default"
|
|
367
|
-
buttons
|
|
368
|
-
></b-form-radio-group>
|
|
369
|
-
</b-form-group>
|
|
370
|
-
|
|
371
|
-
<b-form-group
|
|
372
|
-
label="Button style radios with outline-primary variant and size lg"
|
|
373
|
-
v-slot="{ ariaDescribedby }"
|
|
374
|
-
>
|
|
375
|
-
<b-form-radio-group
|
|
376
|
-
id="btn-radios-2"
|
|
377
|
-
v-model="selected"
|
|
378
|
-
:options="options"
|
|
379
|
-
:aria-describedby="ariaDescribedby"
|
|
380
|
-
button-variant="outline-primary"
|
|
381
|
-
size="lg"
|
|
382
|
-
name="radio-btn-outline"
|
|
383
|
-
buttons
|
|
384
|
-
></b-form-radio-group>
|
|
385
|
-
</b-form-group>
|
|
386
|
-
|
|
387
|
-
<b-form-group label="Stacked button style radios" v-slot="{ ariaDescribedby }">
|
|
388
|
-
<b-form-radio-group
|
|
389
|
-
id="btn-radios-3"
|
|
390
|
-
v-model="selected"
|
|
391
|
-
:options="options"
|
|
392
|
-
:aria-describedby="ariaDescribedby"
|
|
393
|
-
name="radio-btn-stacked"
|
|
394
|
-
buttons
|
|
395
|
-
stacked
|
|
396
|
-
></b-form-radio-group>
|
|
397
|
-
</b-form-group>
|
|
398
|
-
</div>
|
|
399
|
-
</template>
|
|
400
|
-
|
|
401
|
-
<script>
|
|
402
|
-
export default {
|
|
403
|
-
data() {
|
|
404
|
-
return {
|
|
405
|
-
selected: 'radio1',
|
|
406
|
-
options: [
|
|
407
|
-
{ text: 'Radio 1', value: 'radio1' },
|
|
408
|
-
{ text: 'Radio 3', value: 'radio2' },
|
|
409
|
-
{ text: 'Radio 3 (disabled)', value: 'radio3', disabled: true },
|
|
410
|
-
{ text: 'Radio 4', value: 'radio4' }
|
|
411
|
-
]
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
</script>
|
|
416
|
-
|
|
417
|
-
<!-- b-form-radio-buttons.vue -->
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
## Non-custom style radio inputs (plain)
|
|
421
|
-
|
|
422
|
-
You can have `<b-form-radio>` and `<b-form-radio-group>` render a browser native-styled radio input
|
|
423
|
-
by setting the `plain` prop.
|
|
424
|
-
|
|
425
|
-
```html
|
|
426
|
-
<template>
|
|
427
|
-
<div>
|
|
428
|
-
<b-form-group label="Plain inline radios" v-slot="{ ariaDescribedby }">
|
|
429
|
-
<b-form-radio-group
|
|
430
|
-
v-model="selected"
|
|
431
|
-
:options="options"
|
|
432
|
-
:aria-describedby="ariaDescribedby"
|
|
433
|
-
name="plain-inline"
|
|
434
|
-
plain
|
|
435
|
-
></b-form-radio-group>
|
|
436
|
-
</b-form-group>
|
|
437
|
-
|
|
438
|
-
<b-form-group label="Plain stacked radios" v-slot="{ ariaDescribedby }">
|
|
439
|
-
<b-form-radio-group
|
|
440
|
-
v-model="selected"
|
|
441
|
-
:options="options"
|
|
442
|
-
:aria-describedby="ariaDescribedby"
|
|
443
|
-
name="plain-stacked"
|
|
444
|
-
plain
|
|
445
|
-
stacked
|
|
446
|
-
></b-form-radio-group>
|
|
447
|
-
</b-form-group>
|
|
448
|
-
</div>
|
|
449
|
-
</template>
|
|
450
|
-
|
|
451
|
-
<script>
|
|
452
|
-
export default {
|
|
453
|
-
data() {
|
|
454
|
-
return {
|
|
455
|
-
selected: 'first',
|
|
456
|
-
options: [
|
|
457
|
-
{ text: 'First radio', value: 'first' },
|
|
458
|
-
{ text: 'Second radio', value: 'second' },
|
|
459
|
-
{ text: 'Third radio', value: 'third' }
|
|
460
|
-
]
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
</script>
|
|
465
|
-
|
|
466
|
-
<!-- b-form-radio-plain.vue -->
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
**Note:** `plain` will have no effect if `buttons`/`button` is set.
|
|
470
|
-
|
|
471
344
|
## Required constraint
|
|
472
345
|
|
|
473
346
|
When using individual `<b-form-radio>` components (not in a `<b-form-radio-group>`), and you want
|
|
@@ -503,8 +376,6 @@ Generally speaking, you'll want to use a particular state for specific types of
|
|
|
503
376
|
To apply one of the contextual state icons on `<b-form-radio>`, set the `state` prop to `false` (for
|
|
504
377
|
invalid), `true` (for valid), or `null` (no validation state).
|
|
505
378
|
|
|
506
|
-
**Note:** Contextual state is not supported for radios rendered in buttons mode.
|
|
507
|
-
|
|
508
379
|
### Contextual state with feedback example
|
|
509
380
|
|
|
510
381
|
```html
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils'
|
|
2
2
|
import { waitNT } from '../../../tests/utils'
|
|
3
3
|
import { BFormRadioGroup } from './form-radio-group'
|
|
4
|
-
import { BFormRadio } from './form-radio'
|
|
5
4
|
|
|
6
5
|
describe('form-radio-group', () => {
|
|
7
6
|
// --- Structure, class and attributes tests ---
|
|
@@ -221,117 +220,6 @@ describe('form-radio-group', () => {
|
|
|
221
220
|
wrapper.destroy()
|
|
222
221
|
})
|
|
223
222
|
|
|
224
|
-
// --- Button mode structure ---
|
|
225
|
-
|
|
226
|
-
it('button mode has classes button-group and button-group-toggle', async () => {
|
|
227
|
-
const wrapper = mount(BFormRadioGroup, {
|
|
228
|
-
attachTo: document.body,
|
|
229
|
-
propsData: {
|
|
230
|
-
buttons: true
|
|
231
|
-
}
|
|
232
|
-
})
|
|
233
|
-
expect(wrapper.classes()).toBeDefined()
|
|
234
|
-
expect(wrapper.classes().length).toBe(3)
|
|
235
|
-
expect(wrapper.classes()).toContain('btn-group')
|
|
236
|
-
expect(wrapper.classes()).toContain('btn-group-toggle')
|
|
237
|
-
expect(wrapper.classes()).toContain('bv-no-focus-ring')
|
|
238
|
-
|
|
239
|
-
wrapper.destroy()
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
it('button mode has classes button-group-vertical and button-group-toggle when stacked=true', async () => {
|
|
243
|
-
const wrapper = mount(BFormRadioGroup, {
|
|
244
|
-
attachTo: document.body,
|
|
245
|
-
propsData: {
|
|
246
|
-
buttons: true,
|
|
247
|
-
stacked: true
|
|
248
|
-
}
|
|
249
|
-
})
|
|
250
|
-
expect(wrapper.classes()).toBeDefined()
|
|
251
|
-
expect(wrapper.classes().length).toBe(3)
|
|
252
|
-
expect(wrapper.classes()).toContain('btn-group-vertical')
|
|
253
|
-
expect(wrapper.classes()).toContain('btn-group-toggle')
|
|
254
|
-
expect(wrapper.classes()).toContain('bv-no-focus-ring')
|
|
255
|
-
|
|
256
|
-
wrapper.destroy()
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
it('button mode has size class when size prop set', async () => {
|
|
260
|
-
const wrapper = mount(BFormRadioGroup, {
|
|
261
|
-
attachTo: document.body,
|
|
262
|
-
propsData: {
|
|
263
|
-
buttons: true,
|
|
264
|
-
size: 'lg'
|
|
265
|
-
}
|
|
266
|
-
})
|
|
267
|
-
expect(wrapper.classes()).toBeDefined()
|
|
268
|
-
expect(wrapper.classes().length).toBe(4)
|
|
269
|
-
expect(wrapper.classes()).toContain('btn-group')
|
|
270
|
-
expect(wrapper.classes()).toContain('btn-group-toggle')
|
|
271
|
-
expect(wrapper.classes()).toContain('btn-group-lg')
|
|
272
|
-
expect(wrapper.classes()).toContain('bv-no-focus-ring')
|
|
273
|
-
|
|
274
|
-
wrapper.destroy()
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
it('button mode has size class when size prop set and stacked', async () => {
|
|
278
|
-
const wrapper = mount(BFormRadioGroup, {
|
|
279
|
-
attachTo: document.body,
|
|
280
|
-
propsData: {
|
|
281
|
-
buttons: true,
|
|
282
|
-
stacked: true,
|
|
283
|
-
size: 'lg'
|
|
284
|
-
}
|
|
285
|
-
})
|
|
286
|
-
expect(wrapper.classes()).toBeDefined()
|
|
287
|
-
expect(wrapper.classes().length).toBe(4)
|
|
288
|
-
expect(wrapper.classes()).toContain('btn-group-vertical')
|
|
289
|
-
expect(wrapper.classes()).toContain('btn-group-toggle')
|
|
290
|
-
expect(wrapper.classes()).toContain('btn-group-lg')
|
|
291
|
-
expect(wrapper.classes()).toContain('bv-no-focus-ring')
|
|
292
|
-
|
|
293
|
-
wrapper.destroy()
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
it('button mode button-variant works', async () => {
|
|
297
|
-
const App = {
|
|
298
|
-
render(h) {
|
|
299
|
-
return h(
|
|
300
|
-
BFormRadioGroup,
|
|
301
|
-
{
|
|
302
|
-
props: {
|
|
303
|
-
checked: '',
|
|
304
|
-
buttons: true,
|
|
305
|
-
buttonVariant: 'primary'
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
|
-
[
|
|
309
|
-
h(BFormRadio, { props: { value: 'one' } }, 'button 1'),
|
|
310
|
-
h(BFormRadio, { props: { value: 'two' } }, 'button 2'),
|
|
311
|
-
h(BFormRadio, { props: { value: 'three', buttonVariant: 'danger' } }, 'button 3')
|
|
312
|
-
]
|
|
313
|
-
)
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const wrapper = mount(App, {
|
|
318
|
-
attachTo: document.body
|
|
319
|
-
})
|
|
320
|
-
expect(wrapper).toBeDefined()
|
|
321
|
-
await waitNT(wrapper.vm)
|
|
322
|
-
|
|
323
|
-
// Find all the labels with .btn class
|
|
324
|
-
const btns = wrapper.findAll('label.btn')
|
|
325
|
-
expect(btns).toBeDefined()
|
|
326
|
-
expect(btns.length).toBe(3)
|
|
327
|
-
// Expect them to have the correct variant classes
|
|
328
|
-
expect(btns.at(0).classes()).toContain('btn-primary')
|
|
329
|
-
expect(btns.at(1).classes()).toContain('btn-primary')
|
|
330
|
-
expect(btns.at(2).classes()).toContain('btn-danger')
|
|
331
|
-
|
|
332
|
-
wrapper.destroy()
|
|
333
|
-
})
|
|
334
|
-
|
|
335
223
|
// --- Functionality testing ---
|
|
336
224
|
|
|
337
225
|
it('has radios via options array', async () => {
|