forked from hashicorp/vault
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: Glimmerize BoxRadio and AlertPopup (hashicorp#19571)
- Loading branch information
1 parent
670c952
commit 9a84a8e
Showing
6 changed files
with
71 additions
and
48 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
ui/app/templates/components/alert-popup.hbs → ui/lib/core/addon/components/alert-popup.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'core/components/alert-popup'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'vault/tests/helpers'; | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import { click } from '@ember/test-helpers'; | ||
|
||
module('Integration | Component | alert-popup', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
hooks.beforeEach(function () { | ||
this.set('message', 'some very important alert'); | ||
this.set('type', 'warning'); | ||
this.set('close', () => this.set('closed', true)); | ||
}); | ||
|
||
test('it renders the alert popup input', async function (assert) { | ||
await render(hbs` | ||
<AlertPopup @message={{this.message}} @type={{message-types this.type}} @close={{this.close}} /> | ||
`); | ||
|
||
assert.dom(this.element).hasText('Warning some very important alert'); | ||
}); | ||
|
||
test('it invokes the close action', async function (assert) { | ||
assert.expect(1); | ||
|
||
await render(hbs` | ||
<AlertPopup @message={{this.message}} @type={{message-types this.type}} @close={{this.close}} /> | ||
`); | ||
await click('.close-button'); | ||
|
||
assert.true(this.closed); | ||
}); | ||
|
||
test('it renders the alert popup with different colors based on types', async function (assert) { | ||
await render(hbs` | ||
<AlertPopup @message={{this.message}} @type={{message-types this.type}} @close={{this.close}} /> | ||
`); | ||
|
||
assert.dom('.message').hasClass('is-highlight'); | ||
|
||
this.set('type', 'info'); | ||
|
||
await render(hbs` | ||
<AlertPopup @message={{this.message}} @type={{message-types this.type}} @close={{this.close}} /> | ||
`); | ||
|
||
assert.dom('.message').hasClass('is-info'); | ||
|
||
this.set('type', 'danger'); | ||
|
||
await render(hbs` | ||
<AlertPopup @message={{this.message}} @type={{message-types this.type}} @close={{this.close}} /> | ||
`); | ||
|
||
assert.dom('.message').hasClass('is-danger'); | ||
}); | ||
}); |