Skip to content

Commit

Permalink
added a currency table cell
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Jul 17, 2024
1 parent 74132b3 commit ccd5d6b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addon/components/table/cell/currency.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Table::Cell::Base @column={{@column}}>
{{#let (or @row.currency @column.currency) as |currency|}}
{{format-currency @value currency}}
{{/let}}
</Table::Cell::Base>
1 change: 1 addition & 0 deletions app/components/table/cell/currency.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '@fleetbase/ember-ui/components/table/cell/currency';
26 changes: 26 additions & 0 deletions tests/integration/components/table/cell/currency-test.js
Original file line number Diff line number Diff line change
@@ -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 | table/cell/currency', 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`<Table::Cell::Currency />`);

assert.dom().hasText('');

// Template block usage:
await render(hbs`
<Table::Cell::Currency>
template block text
</Table::Cell::Currency>
`);

assert.dom().hasText('template block text');
});
});

0 comments on commit ccd5d6b

Please sign in to comment.