From bf1c220ea80e3b170f6b0acd43bf9c4d353c17d6 Mon Sep 17 00:00:00 2001 From: Stanislav Romanov Date: Wed, 14 Sep 2022 10:56:45 +0300 Subject: [PATCH] Add progress-bar --- app/components/progress-bar.hbs | 3 + app/components/progress-bar.js | 3 + app/components/task-toast.hbs | 65 ++++++++++--------- app/components/toast.hbs | 9 ++- app/components/toast.js | 8 +++ .../components/progress-bar-test.js | 26 ++++++++ 6 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 app/components/progress-bar.hbs create mode 100644 app/components/progress-bar.js create mode 100644 tests/integration/components/progress-bar-test.js diff --git a/app/components/progress-bar.hbs b/app/components/progress-bar.hbs new file mode 100644 index 0000000..1ed2eb9 --- /dev/null +++ b/app/components/progress-bar.hbs @@ -0,0 +1,3 @@ +
+
+
diff --git a/app/components/progress-bar.js b/app/components/progress-bar.js new file mode 100644 index 0000000..ad40ade --- /dev/null +++ b/app/components/progress-bar.js @@ -0,0 +1,3 @@ +import Component from '@glimmer/component'; + +export default class ProgressBarComponent extends Component {} diff --git a/app/components/task-toast.hbs b/app/components/task-toast.hbs index d58707d..226d98c 100644 --- a/app/components/task-toast.hbs +++ b/app/components/task-toast.hbs @@ -1,35 +1,38 @@ - {{#if this.icon}} -
- -
- {{/if}} - -
-
Task {{this.taskType}} Uid:{{this.taskUid}}
-
- Status: - {{this.taskStatus}} -
- {{#if this.task.error}} - Error: {{this.task.error.message}} +
+ {{#if this.icon}} +
+ +
{{/if}} -
- +
+
Task {{this.taskType}} Uid:{{this.taskUid}}
+
+ Status: + {{this.taskStatus}} +
+ {{#if this.task.error}} + Error: + {{this.task.error.message}} + {{/if}} +
+ + +
diff --git a/app/components/toast.hbs b/app/components/toast.hbs index 8d261a0..4a519aa 100644 --- a/app/components/toast.hbs +++ b/app/components/toast.hbs @@ -1,11 +1,16 @@ {{#in-element this.toasts.destinationElement insertBefore=null}} {{/in-element}} diff --git a/app/components/toast.js b/app/components/toast.js index ad4db55..13db2ac 100644 --- a/app/components/toast.js +++ b/app/components/toast.js @@ -13,6 +13,14 @@ export default class ToastComponent extends Component { @tracked width; @tracked height; + get autoCloseValue() { + return this.args?.autoCloseDuration ?? 3000; + } + + get autoCloseDuration() { + return this.args?.autoCloseDuration ?? 3000; + } + get top() { const queue = this.toasts.queue; diff --git a/tests/integration/components/progress-bar-test.js b/tests/integration/components/progress-bar-test.js new file mode 100644 index 0000000..d296fdc --- /dev/null +++ b/tests/integration/components/progress-bar-test.js @@ -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 | progress-bar', 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``); + + assert.dom(this.element).hasText(''); + + // Template block usage: + await render(hbs` + + template block text + + `); + + assert.dom(this.element).hasText('template block text'); + }); +});