chore: Add dropdown right alignment tests

This commit is contained in:
Susmitha Girumala committed 2020-08-11 10:00:30 -04:00
1 parent 2223795820
commit 26795b9359
4 files changed
+17 -2

No files matched your search

@@ -86,7 +86,7 @@
z-index: 99;
}
&.dropdown-right {
&.rose-dropdown-right {
.rose-dropdown-content {
right: 0;
}
@@ -1,6 +1,6 @@
<details
...attributes
class="rose-dropdown {{if @alignRight " dropdown-right"}} {{if @style (concat "rose-dropdown-" @style)}}"
class="rose-dropdown {{if @alignRight " rose-dropdown-right"}} {{if @style (concat "rose-dropdown-" @style)}}"
{{on-click-outside this.close}}
>
@@ -9,6 +9,7 @@ module('Integration | Component | rose/dropdown', function (hooks) {
test('it renders', async function (assert) {
await render(hbs`<Rose::Dropdown />`);
assert.ok(find('.rose-dropdown'));
assert.notOk(find('.rose-dropdown-right'));
});
test('it renders with html attributes', async function (assert) {
@@ -32,6 +33,13 @@ module('Integration | Component | rose/dropdown', function (hooks) {
assert.ok(find('.has-icon-only'));
});
test('it supports right aligned content', async function (assert) {
await render(hbs`
<Rose::Dropdown @alignRight={{true}} />
`);
assert.ok(find('.rose-dropdown-right'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Dropdown @text="Click me" as |dropdown|>
<dropdown.link @route="about"/>
@@ -18,4 +18,11 @@ module('Integration | Component | rose/header/utilities', function (hooks) {
</Rose::Header::Utilities>`);
assert.equal(findAll('.rose-dropdown').length, 2);
});
test('it renders nav dropdown elements as right aligned', async function (assert) {
await render(hbs`<Rose::Header::Utilities as |nav| >
<nav.dropdown />
</Rose::Header::Utilities>`);
assert.ok(find('.rose-dropdown.rose-dropdown-right'));
});
});