@madgex/design-system 1.60.7 → 1.60.8

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.
Files changed (85) hide show
  1. package/__tests__/unit/src/components/accordion.spec.js +16 -12
  2. package/coverage/cobertura-coverage.xml +58 -173
  3. package/coverage/components/accordion/accordion.js.html +63 -42
  4. package/coverage/components/accordion/index.html +15 -15
  5. package/coverage/components/inputs/combobox/combobox.js.html +1 -1
  6. package/coverage/components/inputs/combobox/index.html +1 -1
  7. package/coverage/components/inputs/combobox/vue-components/Combobox.vue.html +1 -1
  8. package/coverage/components/inputs/combobox/vue-components/ListBoxOption.vue.html +1 -1
  9. package/coverage/components/inputs/combobox/vue-components/index.html +1 -1
  10. package/coverage/components/inputs/file-upload/file-upload.js.html +1 -1
  11. package/coverage/components/inputs/file-upload/index.html +1 -1
  12. package/coverage/components/inputs/textarea/character-count.js.html +1 -1
  13. package/coverage/components/inputs/textarea/index.html +1 -1
  14. package/coverage/components/modal/index.html +1 -1
  15. package/coverage/components/modal/modal.js.html +1 -1
  16. package/coverage/components/notification/index.html +1 -1
  17. package/coverage/components/notification/notification.js.html +1 -1
  18. package/coverage/components/popover/index.html +1 -1
  19. package/coverage/components/popover/popover.js.html +1 -1
  20. package/coverage/components/switch-state/index.html +1 -1
  21. package/coverage/components/switch-state/switch-state.js.html +1 -1
  22. package/coverage/components/tabs/index.html +1 -1
  23. package/coverage/components/tabs/tabs.js.html +1 -1
  24. package/coverage/index.html +17 -47
  25. package/coverage/js/common.js.html +1 -1
  26. package/coverage/js/fractal-scripts/combobox.js.html +1 -1
  27. package/coverage/js/fractal-scripts/index.html +1 -1
  28. package/coverage/js/fractal-scripts/notification.js.html +1 -1
  29. package/coverage/js/fractal-scripts/switch-state.js.html +1 -1
  30. package/coverage/js/index-fractal.js.html +1 -1
  31. package/coverage/js/index-polyfills.js.html +1 -1
  32. package/coverage/js/index-vue.js.html +3 -6
  33. package/coverage/js/index.html +1 -1
  34. package/coverage/js/index.js.html +1 -1
  35. package/coverage/js/polyfills/arrayPrototypeFind.js.html +1 -1
  36. package/coverage/js/polyfills/closest.js.html +1 -1
  37. package/coverage/js/polyfills/index.html +1 -1
  38. package/coverage/js/polyfills/objectAssign.js.html +1 -1
  39. package/coverage/js/polyfills/remove.js.html +1 -1
  40. package/coverage/tokens/_config.js.html +1 -1
  41. package/coverage/tokens/index.html +1 -1
  42. package/dist/_tokens/css/_tokens.css +1 -1
  43. package/dist/_tokens/js/_tokens-module.js +1 -1
  44. package/dist/_tokens/scss/_tokens.scss +1 -1
  45. package/dist/assets/icons.json +1 -1
  46. package/dist/css/index.css +1 -1
  47. package/dist/js/index.js +5 -5
  48. package/package.json +1 -1
  49. package/src/components/{macro-index.njk → _macro-index.njk} +0 -1
  50. package/src/components/accordion/README.md +18 -7
  51. package/src/components/accordion/_template.njk +46 -52
  52. package/src/components/accordion/accordion.config.js +8 -8
  53. package/src/components/accordion/accordion.js +39 -32
  54. package/src/components/accordion/accordion.njk +2 -1
  55. package/src/components/accordion/accordion.scss +15 -15
  56. package/src/components/inputs/_form-elements.scss +54 -19
  57. package/src/components/inputs/checkbox/README.md +3 -1
  58. package/src/components/inputs/checkbox/_template.njk +80 -17
  59. package/src/components/inputs/checkbox/checkbox.config.js +110 -1
  60. package/src/components/inputs/checkbox/checkbox.njk +3 -1
  61. package/src/components/inputs/label/_template.njk +38 -29
  62. package/src/components/popover/popover.scss +1 -0
  63. package/src/js/index-vue.js +1 -2
  64. package/src/layout/forms/forms.config.js +20 -20
  65. package/src/layout/forms/forms.njk +11 -12
  66. package/src/scss/components/__index.scss +0 -1
  67. package/tasks/createMacroIndex.js +1 -1
  68. package/__tests__/unit/src/components/multiselect.spec.js +0 -91
  69. package/coverage/components/inputs/multi-select/index.html +0 -110
  70. package/coverage/components/inputs/multi-select/multi-select.js.html +0 -175
  71. package/coverage/components/inputs/multi-select/vue-components/MultiSelect.vue.html +0 -229
  72. package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue.html +0 -349
  73. package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue.html +0 -274
  74. package/coverage/components/inputs/multi-select/vue-components/index.html +0 -140
  75. package/cypress/integration/components/multi-select.spec.js +0 -9
  76. package/src/components/inputs/multi-select/README.md +0 -18
  77. package/src/components/inputs/multi-select/_macro.njk +0 -3
  78. package/src/components/inputs/multi-select/_template.njk +0 -57
  79. package/src/components/inputs/multi-select/multi-select.config.js +0 -178
  80. package/src/components/inputs/multi-select/multi-select.js +0 -32
  81. package/src/components/inputs/multi-select/multi-select.njk +0 -16
  82. package/src/components/inputs/multi-select/multi-select.scss +0 -39
  83. package/src/components/inputs/multi-select/vue-components/MultiSelect.vue +0 -50
  84. package/src/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue +0 -90
  85. package/src/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue +0 -65
@@ -1,5 +1,7 @@
1
1
  {% from "../label/_macro.njk" import MdsInputLabel %}
2
2
  {% from "../_message/_macro.njk" import MdsInputMessages %}
3
+ {% from "../../accordion/_macro.njk" import MdsAccordion %}
4
+ {% from "../../icons/_macro.njk" import MdsIcon %}
3
5
 
4
6
  {%- if params.name -%}
5
7
  {%- set name = params.name -%}
@@ -7,7 +9,75 @@
7
9
  {%- set name = params.id -%}
8
10
  {%- endif -%}
9
11
 
12
+ {% macro createCheckboxes(checkboxParams) %}
13
+ {% if checkboxParams.options and checkboxParams.options.length %}
14
+ {% for option in checkboxParams.options %}
15
+ {%- set optionId -%}
16
+ {%- if option.id -%}{#
17
+ #}{{ option.id }}{#
18
+ #}{% else %}{#
19
+ #}{{ checkboxParams.name }}-{{ option.value }}{#
20
+ #}{% endif -%}
21
+ {%- endset -%}
22
+ <div class="mds-form-check{% if option.classes %} {{option.classes}}{% endif %}">
23
+ <input
24
+ type="checkbox"
25
+ class="mds-form-check__input"
26
+ name="{{ checkboxParams.name }}"
27
+ id="{{ optionId }}"
28
+ {% if checkboxParams.disabled %}disabled="disabled"{% endif %}
29
+ {% if option.selected %}checked="checked"{% endif %}
30
+ value="{{ option.value }}"
31
+ />{#
32
+ # Avoid extra space created by line breaks #
33
+ #}<label class="mds-form-check__label" for="{{ optionId }}">{#
34
+ #}{{ option.labelText }}{#
35
+ #}</label>
36
+ {% if option.options and option.options.length %}
37
+ {%- set triggerLabel %}Select options under {{ option.labelText | safe }}{% endset -%}
38
+ {%- set accordionContent %}
39
+ <div class="mds-form-check__nested-container">
40
+ {{ createCheckboxes({
41
+ options: option.options,
42
+ name: checkboxParams.name,
43
+ disabled: checkboxParams.disabled
44
+ }) }}
45
+ </div>
46
+ {% endset -%}
47
+ {{ MdsAccordion({
48
+ id: optionId,
49
+ triggerHtmlTag: 'div',
50
+ triggerLabel: triggerLabel,
51
+ triggerNoJsHidden: true,
52
+ hideTriggerLabel: true,
53
+ content: accordionContent,
54
+ expandIcon: 'chevron-right',
55
+ collapseIcon: 'chevron-down',
56
+ useFieldset: true
57
+ }) }}
58
+ {% endif %}
59
+ </div>
60
+ {% endfor %}
61
+ {% endif %}
62
+ {% endmacro %}
63
+
64
+ {# if there are more than 6 options or if there are nested options then we add a border and fixed height on the container #}
65
+ {% if params.options %}
66
+ {% set hasChildren = false %}
67
+ {% set hasBorder = false %}
68
+ {% for option in params.options %}
69
+ {% if option.options.length %}
70
+ {% set hasChildren = true %}
71
+ {% endif %}
72
+ {% endfor %}
73
+ {% if hasChildren or params.options.length > 6 %}
74
+ {% set hasBorder = true %}
75
+ {% endif %}
76
+ {% endif %}
77
+
10
78
  <div class="mds-form-element mds-form-element--checkbox{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="checkbox">
79
+ {# no need for fieldset and legend if there is only one checkbox #}
80
+ {% if params.options.length > 1 %}
11
81
  <fieldset>
12
82
  {{ MdsInputLabel({
13
83
  element: 'legend',
@@ -17,27 +87,20 @@
17
87
  optional: params.optional,
18
88
  tooltipMessage: params.tooltipMessage
19
89
  }) }}
90
+ {% endif %}
20
91
  {{ MdsInputMessages({
21
92
  id: params.id,
22
93
  helpText: params.helpText,
23
94
  validationError: params.validationError
24
95
  }) }}
25
- {%- for checkbox in params.options -%}
26
- <div class="mds-form-check{% if checkbox.classes %} {{checkbox.classes}}{% endif %}">
27
- <input
28
- type="checkbox"
29
- class="mds-form-check__input"
30
- name="{{name}}"
31
- id="{{checkbox.id}}"
32
- {% if params.disabled %}disabled="disabled"{% endif %}
33
- {% if checkbox.selected %}checked="checked"{% endif %}
34
- value="{{checkbox.value}}"
35
- />{#
36
- # Avoid extra space created by line breaks #
37
- #}<label class="mds-form-check__label" for="{{checkbox.id}}">{#
38
- #}{{checkbox.labelText}}{#
39
- #}</label>
40
- </div>
41
- {% endfor %}
96
+ <div class="mds-form-check-container{% if hasBorder %} mds-form-check-container--border{% endif %}">
97
+ {{ createCheckboxes({
98
+ options: params.options,
99
+ name: name,
100
+ disabled: params.disabled
101
+ }) }}
102
+ </div>
103
+ {% if params.options.length > 1 %}
42
104
  </fieldset>
105
+ {% endif %}
43
106
  </div>
@@ -1,6 +1,5 @@
1
1
  module.exports = {
2
2
  title: 'Checkbox',
3
- status: 'wip',
4
3
  context: {
5
4
  id: 'checkbox-input',
6
5
  labelText: 'Standard checkbox group',
@@ -23,6 +22,8 @@ module.exports = {
23
22
  context: {
24
23
  id: 'inline-checkbox-using-class',
25
24
  labelText: 'Inline checkbox using class',
25
+ tooltipMessage: 'This is a tool tip message to help describe a bit better what you should do with this field.',
26
+ optional: true,
26
27
  classes: 'mds-form-element--inline',
27
28
  options: [
28
29
  {
@@ -65,5 +66,113 @@ module.exports = {
65
66
  ],
66
67
  },
67
68
  },
69
+ {
70
+ name: 'Nested checkboxes',
71
+ context: {
72
+ id: 'nested-checkboxes',
73
+ labelText: 'Industry',
74
+ tooltipMessage: 'Select some options',
75
+ options: [
76
+ {
77
+ value: 101,
78
+ labelText: 'Arts & heritage',
79
+ options: [
80
+ { value: 600102, labelText: 'Artist agency & management', selected: true, options: [] },
81
+ { value: 600104, labelText: 'Arts education & training', options: [] },
82
+ { value: 104, labelText: 'Dance', options: [] },
83
+ { value: 600105, labelText: 'Events', options: [] },
84
+ { value: 600106, labelText: 'Festival', selected: true, options: [] },
85
+ { value: 600107, labelText: 'Funding body', options: [] },
86
+ { value: 107, labelText: 'Heritage', options: [] },
87
+ { value: 600109, labelText: 'Librarian & archivist', options: [] },
88
+ { value: 108, labelText: 'Museums & galleries', selected: true, options: [] },
89
+ { value: 109, labelText: 'Music', options: [] },
90
+ { value: 600110, labelText: 'Press, publicity & PR', options: [] },
91
+ { value: 600111, labelText: 'Promoter', options: [] },
92
+ { value: 110, labelText: 'Theatre', options: [] },
93
+ { value: 600113, labelText: 'Venue', options: [] },
94
+ { value: 106, labelText: 'Visual arts', options: [] },
95
+ { value: 600114, labelText: 'Writing & literature', options: [] },
96
+ ],
97
+ },
98
+ {
99
+ value: 111,
100
+ labelText: 'Charities',
101
+ options: [
102
+ { value: 112, labelText: 'Advice', options: [] },
103
+ { value: 113, labelText: 'Advocacy', options: [] },
104
+ { value: 114, labelText: 'Animal', options: [] },
105
+ { value: 600116, labelText: 'Arts & culture', options: [] },
106
+ { value: 600117, labelText: 'Charity & volunteering support', options: [] },
107
+ { value: 115, labelText: 'Children', options: [] },
108
+ { value: 600118, labelText: 'Community development', options: [] },
109
+ { value: 600119, labelText: 'Crime', options: [] },
110
+ { value: 116, labelText: 'Disability', options: [] },
111
+ { value: 117, labelText: 'Environment', options: [] },
112
+ { value: 118, labelText: 'Equality', options: [] },
113
+ { value: 600120, labelText: 'Faith-based', options: [] },
114
+ { value: 119, labelText: 'Fundraising', options: [] },
115
+ { value: 121, labelText: 'Health', options: [] },
116
+ { value: 600122, labelText: 'Housing & homelessness', options: [] },
117
+ { value: 348, labelText: 'Human rights', options: [] },
118
+ { value: 122, labelText: 'International', options: [] },
119
+ { value: 300, labelText: 'Mental health', options: [] },
120
+ { value: 600123, labelText: 'Policy & research', options: [] },
121
+ { value: 600124, labelText: 'Poverty relief', options: [] },
122
+ { value: 600125, labelText: 'Social welfare', options: [] },
123
+ { value: 349, labelText: 'Trustee', options: [] },
124
+ { value: 600126, labelText: 'Volunteer management', options: [] },
125
+ ],
126
+ },
127
+ { value: 124, labelText: 'Construction', options: [] },
128
+ { value: 142, labelText: 'Design', options: [] },
129
+ {
130
+ value: 137,
131
+ labelText: 'Engineering',
132
+ options: [
133
+ { value: 138, labelText: 'General', options: [] },
134
+ { value: 139, labelText: 'Manufacturing', options: [] },
135
+ { value: 140, labelText: 'Utility', options: [] },
136
+ ],
137
+ },
138
+ {
139
+ value: 141,
140
+ labelText: 'Environment',
141
+ options: [
142
+ { value: 600131, labelText: 'Agriculture & land management', options: [] },
143
+ { value: 600132, labelText: 'Auditing', options: [] },
144
+ { value: 147, labelText: 'Built environment', options: [] },
145
+ { value: 600136, labelText: 'Climate change', options: [] },
146
+ { value: 600137, labelText: 'Corporate social responsibility', options: [] },
147
+ { value: 600138, labelText: 'Ecology & conservation', options: [] },
148
+ { value: 600139, labelText: 'Energy efficiency & renewable energy', options: [] },
149
+ { value: 600140, labelText: 'Energy management', options: [] },
150
+ { value: 143, labelText: 'Environmental education', options: [] },
151
+ { value: 600141, labelText: 'Environmental management', options: [] },
152
+ { value: 145, labelText: 'Green & clean technology', options: [] },
153
+ { value: 600143, labelText: 'International development', options: [] },
154
+ { value: 146, labelText: 'Policy, legislation & strategy', options: [] },
155
+ { value: 148, labelText: 'Recycling & waste management', options: [] },
156
+ { value: 600145, labelText: 'Supply chain', options: [] },
157
+ { value: 600146, labelText: 'Sustainability', options: [] },
158
+ { value: 600147, labelText: 'Water & wastewater', options: [] },
159
+ ],
160
+ },
161
+ ],
162
+ },
163
+ },
164
+ {
165
+ name: 'Single checkbox',
166
+ context: {
167
+ id: 'single-checkbox',
168
+ options: [
169
+ {
170
+ labelText: 'I agree to the terms and conditions',
171
+ value: 'agree-terms',
172
+ id: 'terms-and-conditions',
173
+ },
174
+ ],
175
+ },
176
+ },
68
177
  ],
69
178
  };
@@ -7,6 +7,8 @@
7
7
  id: id,
8
8
  disabled: disabled,
9
9
  options: options,
10
- classes: classes
10
+ classes: classes,
11
+ tooltipMessage: tooltipMessage,
12
+ optional: optional
11
13
  }) }}
12
14
  </div>
@@ -5,33 +5,42 @@
5
5
  #}mds-form-label__label
6
6
  {%- endset -%}
7
7
 
8
- <div class="mds-form-label{% if params.hideLabel %} mds-visually-hidden{% endif -%}">
9
- {%- if params.element == 'legend' -%}
10
- <legend class="{{ classes }}">
11
- {%- else -%}
12
- <label class="{{ classes }}" for="{{ params.id }}">
13
- {%- endif -%}
14
- {{ params.labelText }}
15
- {%- if params.optional -%}
16
- <span class="mds-form-label__optional"> (optional)</span>
17
- {%- endif -%}
18
- {%- if params.element == 'legend' -%}
19
- </legend>
20
- {%- else -%}
21
- </label>
22
- {%- endif -%}
8
+ {%- if params.element == 'legend' -%}
9
+ {# <legend> must the immediate child of <fieldset> #}
10
+ <legend class="mds-form-label{% if params.tooltipMessage %} mds-form-label--legend-with-tooltip{% endif %}{% if params.hideLabel %} mds-visually-hidden{% endif -%}">
11
+ <span class="{{ classes }}">
12
+ {%- else -%}
13
+ <div class="mds-form-label{% if params.hideLabel %} mds-visually-hidden{% endif -%}">
14
+ <label class="{{ classes }}" for="{{ params.id }}">
15
+ {%- endif -%}
16
+ {{ params.labelText }}
17
+ {%- if params.optional -%}
18
+ <span class="mds-form-label__optional"> (optional)</span>
19
+ {%- endif -%}
20
+ {%- if params.element == 'legend' -%}
21
+ </span>
22
+ </legend>
23
+ {%- else -%}
24
+ </label>
25
+ {%- endif -%}
23
26
 
24
- {%- if params.tooltipMessage -%}
25
- {{- MdsPopover({
26
- id: params.id + '-tooltip',
27
- text: MdsIcon({
28
- iconName: 'question-mark',
29
- classes: 'mds-icon--info',
30
- visuallyHiddenLabel: 'More info'
31
- }),
32
- placement: 'right',
33
- classes: 'mds-button mds-button--plain mds-form-label__tooltip',
34
- content: params.tooltipMessage
35
- }) -}}
36
- {%- endif -%}
37
- </div>
27
+ {%- if params.tooltipMessage -%}
28
+ {{- MdsPopover({
29
+ id: params.id + '-tooltip',
30
+ text: MdsIcon({
31
+ iconName: 'question-mark',
32
+ classes: 'mds-icon--info',
33
+ visuallyHiddenLabel: 'More info'
34
+ }),
35
+ placement: 'right',
36
+ classes: 'mds-button mds-button--plain mds-form-label__tooltip',
37
+ content: params.tooltipMessage
38
+ }) -}}
39
+ {%- endif -%}
40
+ {%- if params.element == 'legend' -%}
41
+ {# <legend> is using a float:left to get the tooltip icon to line up next to it #}
42
+ {# Sorry I couldn't find antyhing else to target #}
43
+ <span class="mds-clearfix"></span>
44
+ {% else %}
45
+ </div>
46
+ {%- endif -%}
@@ -16,6 +16,7 @@ $arrow-size: 10px;
16
16
  box-shadow: $mds-color-box-shadow-base;
17
17
  text-align: left;
18
18
  max-width: 250px;
19
+ @include z-index(popup);
19
20
  }
20
21
 
21
22
  .mds-popover__arrow {
@@ -2,7 +2,6 @@ import 'document-register-element/build/document-register-element';
2
2
  import Vue from 'vue';
3
3
  import vueCustomElement from 'vue-custom-element';
4
4
  import MdsCombobox from '../components/inputs/combobox/combobox';
5
- import MdsMultiSelect from '../components/inputs/multi-select/multi-select';
6
5
 
7
6
  Vue.use(vueCustomElement);
8
7
  Vue.config.devtools = process.env.NODE_ENV === 'development';
@@ -10,6 +9,6 @@ Vue.config.devtools = process.env.NODE_ENV === 'development';
10
9
  Vue.config.keyCodes.end = 35;
11
10
  Vue.config.keyCodes.home = 36;
12
11
 
13
- [MdsCombobox, MdsMultiSelect].forEach(({ name, component, hooks }) => {
12
+ [MdsCombobox].forEach(({ name, component, hooks }) => {
14
13
  Vue.customElement(name, component, hooks);
15
14
  });
@@ -7,26 +7,26 @@ module.exports = {
7
7
  id: 'email',
8
8
  type: 'email',
9
9
  },
10
- multiselect: {
10
+ checkbox1: {
11
11
  labelText: 'Role',
12
- name: 'Role',
13
- terms: [
14
- { id: 7, label: 'Academic Pharmacist', terms: [] },
15
- { id: 1, label: 'Community Pharmacist', terms: [] },
16
- { id: 10, label: 'Dispensing Assistant', terms: [] },
17
- { id: 4, label: 'Hospital Pharmacist', selected: true, terms: [] },
18
- { id: 6, label: 'Industrial Pharmacist', terms: [] },
19
- { id: 3, label: 'Locum Pharmacist', terms: [] },
20
- { id: 11, label: 'Medicines Counter Assistant', terms: [] },
21
- { id: 2, label: 'Pharmacy Manager', terms: [] },
22
- { id: 12, label: 'Pharmacy Student', terms: [] },
23
- { id: 9, label: 'Pharmacy Technician', terms: [] },
24
- { id: 8, label: 'Pre-reg Pharmacist', selected: true, terms: [] },
25
- { id: 513016, label: 'Primary Care Pharmacist', terms: [] },
26
- { id: 513015, label: 'Region/Area Manager', terms: [] },
27
- { id: 5, label: 'Senior Management', terms: [] },
28
- { id: 513014, label: 'Superintendent Pharmacist', terms: [] },
29
- { id: 13, label: 'Other Pharmacy roles', terms: [] },
12
+ id: 'role',
13
+ options: [
14
+ { value: 7, labelText: 'Academic Pharmacist', options: [] },
15
+ { value: 1, labelText: 'Community Pharmacist', options: [] },
16
+ { value: 10, labelText: 'Dispensing Assistant', options: [] },
17
+ { value: 4, labelText: 'Hospital Pharmacist', selected: true, options: [] },
18
+ { value: 6, labelText: 'Industrial Pharmacist', options: [] },
19
+ { value: 3, labelText: 'Locum Pharmacist', options: [] },
20
+ { value: 11, labelText: 'Medicines Counter Assistant', options: [] },
21
+ { value: 2, labelText: 'Pharmacy Manager', options: [] },
22
+ { value: 12, labelText: 'Pharmacy Student', options: [] },
23
+ { value: 9, labelText: 'Pharmacy Technician', options: [] },
24
+ { value: 8, labelText: 'Pre-reg Pharmacist', selected: true, options: [] },
25
+ { value: 513016, labelText: 'Primary Care Pharmacist', options: [] },
26
+ { value: 513015, labelText: 'Region/Area Manager', options: [] },
27
+ { value: 5, labelText: 'Senior Management', options: [] },
28
+ { value: 513014, labelText: 'Superintendent Pharmacist', options: [] },
29
+ { value: 13, labelText: 'Other Pharmacy roles', options: [] },
30
30
  ],
31
31
  },
32
32
  combobox: {
@@ -36,7 +36,7 @@ module.exports = {
36
36
  fallbackTo: 'select',
37
37
  optional: true,
38
38
  },
39
- checkbox: {
39
+ checkbox2: {
40
40
  id: 'checkbox-input',
41
41
  labelText: 'Hours',
42
42
  optional: true,
@@ -1,7 +1,6 @@
1
1
  {% from "../components/inputs/checkbox/_macro.njk" import MdsCheckbox %}
2
2
  {% from "../components/inputs/combobox/_macro.njk" import MdsCombobox %}
3
3
  {% from "../components/inputs/input/_macro.njk" import MdsInput %}
4
- {% from "../components/inputs/multi-select/_macro.njk" import MdsMultiSelect %}
5
4
  {% from "../components/inputs/radio/_macro.njk" import MdsRadio %}
6
5
  {% from "../components/inputs/select/_macro.njk" import MdsSelect %}
7
6
  {% from "../components/inputs/label/_macro.njk" import MdsInputLabel %}
@@ -21,12 +20,12 @@
21
20
  }) }}
22
21
  </div>
23
22
  <div class="mds-form-field">
24
- {{ MdsMultiSelect({
25
- labelText: multiselect.labelText,
26
- name: multiselect.name,
27
- terms: multiselect.terms,
28
- optional: multiselect.optional,
29
- tooltipMessage: multiselect.tooltipMessage
23
+ {{ MdsCheckbox({
24
+ labelText: checkbox1.labelText,
25
+ id: checkbox1.id,
26
+ options: checkbox1.options,
27
+ optional: checkbox1.optional,
28
+ tooltipMessage: checkbox1.tooltipMessage
30
29
  }) }}
31
30
  </div>
32
31
  <div class="mds-form-field">
@@ -53,11 +52,11 @@
53
52
  </div>
54
53
  <div class="mds-form-field">
55
54
  {{ MdsCheckbox({
56
- labelText: checkbox.labelText,
57
- id: checkbox.id,
58
- options: checkbox.options,
59
- optional: checkbox.optional,
60
- tooltipMessage: checkbox.tooltipMessage
55
+ labelText: checkbox2.labelText,
56
+ id: checkbox2.id,
57
+ options: checkbox2.options,
58
+ optional: checkbox2.optional,
59
+ tooltipMessage: checkbox2.tooltipMessage
61
60
  }) }}
62
61
  </div>
63
62
  <fieldset class="mds-form-field">
@@ -10,7 +10,6 @@
10
10
  @import '../../components/notification/notification';
11
11
  @import '../../components/inputs/form-elements';
12
12
  @import '../../components/inputs/combobox/combobox';
13
- @import '../../components/inputs/multi-select/multi-select';
14
13
  @import '../../components/inputs/file-upload/file-upload';
15
14
  @import '../../components/inputs/textarea/textarea';
16
15
  @import '../../components/modal/modal';
@@ -40,7 +40,7 @@ async function createMacroIndex(cb) {
40
40
  )
41
41
  .join('\n');
42
42
 
43
- fs.writeFileSync(`${componentRootDir}/macro-index.njk`, template);
43
+ fs.writeFileSync(`${componentRootDir}/_macro-index.njk`, template);
44
44
 
45
45
  cb();
46
46
  }
@@ -1,91 +0,0 @@
1
- /* eslint-disable prettier/prettier */
2
- import Vue from 'vue';
3
- import { mount } from '@vue/test-utils';
4
- import MultiSelect from '../../../../src/components/inputs/multi-select/vue-components/MultiSelect.vue';
5
- import MultiSelectCheckbox from '../../../../src/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue';
6
- import MultiSelectCheckboxGroup from '../../../../src/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue';
7
-
8
- describe('Multiselect', () => {
9
- let wrapper;
10
- let childGroups;
11
-
12
- beforeEach(() => {
13
- wrapper = mount(MultiSelect, {
14
- propsData: {
15
- labeltext: "Choose your test",
16
- name: "test-chooser",
17
- options: [
18
- {
19
- "id": "test-1",
20
- "name": "tests",
21
- "value": "test-group-1",
22
- "label": "Test group one",
23
- "checked": false,
24
- "children": [
25
- {
26
- "id": "test-1-01",
27
- "name": "tests",
28
- "value": "test-1-1",
29
- "label": "Test one one",
30
- "children": null,
31
- "checked": false
32
- },
33
- {
34
- "id": "test-1-02",
35
- "name": "tests",
36
- "value": "test-1-2",
37
- "label": "Test one two",
38
- "children": null,
39
- "checked": true
40
- }
41
- ]
42
- },
43
- {
44
- "id": "test-2",
45
- "name": "tests",
46
- "value": "test-group-2",
47
- "label": "Test group two",
48
- "checked": false,
49
- "children": null
50
- },
51
- {
52
- "id": "test-3",
53
- "name": "tests",
54
- "value": "test-group-3",
55
- "label": "Test group three",
56
- "checked": false,
57
- "children": null
58
- }
59
- ]
60
- },
61
- });
62
- });
63
-
64
- it('is a vue instance', () => {
65
- expect.assertions(1);
66
- expect(wrapper.isVueInstance()).toBe(true);
67
- });
68
-
69
- describe('Checkbox list', () => {
70
- it('renders the parent checkboxes', () => {
71
- const parents = wrapper.find(MultiSelectCheckboxGroup);
72
- expect.assertions(1);
73
- expect(parents.vm.$children).toHaveLength(3);
74
- });
75
-
76
- it('has children where applicable', () => {
77
- expect.assertions(1);
78
- const parent = wrapper.find('[data-multiselect-id="tests-checkbox"]');
79
- expect(parent.vm.$children[0].$children.length).toBe(2);
80
- });
81
-
82
- it('expands when clicked', () => {
83
- const triggerButton = wrapper.find('[data-multiselect-id="tests-checkbox"] > .mds-button');
84
- const childGroup = wrapper.find('[data-multiselect-id="test-chooser-test-1-group"]');
85
- expect(childGroup.isVisible()).toBe(false);
86
- triggerButton.trigger('click');
87
- expect(wrapper.isVisible()).toBe(true);
88
- expect.assertions(2);
89
- });
90
- });
91
- });