Move toasts to subdirectory

This commit is contained in:
Stanislav Romanov 2022-09-21 13:31:59 +03:00
parent e11ed97287
commit d2b110ab84
10 changed files with 59 additions and 35 deletions

View file

@ -1,3 +0,0 @@
import Component from '@glimmer/component';
export default class SuccessToastComponent extends Component {}

View file

@ -0,0 +1,3 @@
import Component from '@glimmer/component';
export default class ToastSuccessComponent extends Component {}

View file

@ -4,10 +4,10 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { Loading, Check, AlertOctagonOutline } from 'ember-mdi';
import Task from '../models/task';
import Task from 'meiliadmin/models/task';
// TODO: refactor for using more inside Task logic
export default class TaskToastComponent extends Component {
export default class ToastTaskComponent extends Component {
@service meilisearch;
@tracked task;

View file

@ -2,8 +2,8 @@ import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { hbs } from 'ember-template-imports';
import { action } from '@ember/object';
import SuccessToast from '../components/success-toast';
import TaskToast from '../components/task-toast';
import SuccessToast from '../components/toast/success';
import TaskToast from '../components/toast/task';
export default class ToasterService extends Service {
@tracked container = [];

View file

@ -1,14 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'meiliadmin/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | success-toast', function (hooks) {
setupRenderingTest(hooks);
// test('it renders', async function (assert) {
// await render(hbs`<SuccessToast />`);
// assert.dom(this.element).hasText('');
// });
});

View file

@ -1,14 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'meiliadmin/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | task-toast', function (hooks) {
setupRenderingTest(hooks);
// test('it renders', async function (assert) {
// await render(hbs`<TaskToast />`);
// assert.dom(this.element).hasText('');
// });
});

View file

@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'meiliadmin/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | toast/success', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<Toast::Success />`);
assert.dom(this.element).hasText('');
// Template block usage:
await render(hbs`
<Toast::Success>
template block text
</Toast::Success>
`);
assert.dom(this.element).hasText('template block text');
});
});

View file

@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'meiliadmin/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | toast/task', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<Toast::Task />`);
assert.dom(this.element).hasText('');
// Template block usage:
await render(hbs`
<Toast::Task>
template block text
</Toast::Task>
`);
assert.dom(this.element).hasText('template block text');
});
});