From 1238f070d7040a55bb559151e9fff37a4b6824e8 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 19 Jul 2024 15:40:54 +0800 Subject: [PATCH] added new `` component --- addon/components/progress-bar.hbs | 12 +++++++++ addon/components/progress-bar.js | 8 ++++++ app/components/progress-bar.js | 1 + .../components/progress-bar-test.js | 26 +++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 addon/components/progress-bar.hbs create mode 100644 addon/components/progress-bar.js create mode 100644 app/components/progress-bar.js create mode 100644 tests/integration/components/progress-bar-test.js diff --git a/addon/components/progress-bar.hbs b/addon/components/progress-bar.hbs new file mode 100644 index 0000000..60d46dc --- /dev/null +++ b/addon/components/progress-bar.hbs @@ -0,0 +1,12 @@ +
+
+

{{@title}}

+ {{@percent}}% +
+
+
+
+
\ No newline at end of file diff --git a/addon/components/progress-bar.js b/addon/components/progress-bar.js new file mode 100644 index 0000000..0cff7ee --- /dev/null +++ b/addon/components/progress-bar.js @@ -0,0 +1,8 @@ +import Component from '@glimmer/component'; +import { action } from '@ember/object'; + +export default class ProgressBarComponent extends Component { + @action setProgress(el, [percent]) { + el.style.width = `${percent}%`; + } +} diff --git a/app/components/progress-bar.js b/app/components/progress-bar.js new file mode 100644 index 0000000..50c769c --- /dev/null +++ b/app/components/progress-bar.js @@ -0,0 +1 @@ +export { default } from '@fleetbase/ember-ui/components/progress-bar'; diff --git a/tests/integration/components/progress-bar-test.js b/tests/integration/components/progress-bar-test.js new file mode 100644 index 0000000..2008d3d --- /dev/null +++ b/tests/integration/components/progress-bar-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'dummy/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().hasText(''); + + // Template block usage: + await render(hbs` + + template block text + + `); + + assert.dom().hasText('template block text'); + }); +});