diff --git a/ui/app/styles/components/dropdown.scss b/ui/app/styles/components/dropdown.scss index 53bab9929..7eb4c33f3 100644 --- a/ui/app/styles/components/dropdown.scss +++ b/ui/app/styles/components/dropdown.scss @@ -142,4 +142,10 @@ } } } + + .dropdown-empty { + display: block; + padding: 8px 12px; + color: $grey-light; + } } diff --git a/ui/app/templates/components/multi-select-dropdown.hbs b/ui/app/templates/components/multi-select-dropdown.hbs index 5e1f4aa09..fed2fdf47 100644 --- a/ui/app/templates/components/multi-select-dropdown.hbs +++ b/ui/app/templates/components/multi-select-dropdown.hbs @@ -28,6 +28,8 @@ {{option.label}} + {{else}} + No options {{/each}} {{/dd.content}} diff --git a/ui/tests/integration/multi-select-dropdown-test.js b/ui/tests/integration/multi-select-dropdown-test.js index 9b9ff1b03..f619ba808 100644 --- a/ui/tests/integration/multi-select-dropdown-test.js +++ b/ui/tests/integration/multi-select-dropdown-test.js @@ -297,3 +297,15 @@ test('pressing ESC when the options list is open closes the list and returns foc 'The trigger has focus' ); }); + +test('when there are no list options, an empty message is shown', function(assert) { + const props = commonProperties(); + props.options = []; + this.setProperties(props); + this.render(commonTemplate); + + click('[data-test-dropdown-trigger]'); + assert.ok(find('[data-test-dropdown-options]'), 'The dropdown is still shown'); + assert.ok(find('[data-test-dropdown-empty]'), 'The empty state is shown'); + assert.notOk(find('[data-test-dropdown-option]'), 'No options are shown'); +});