Skip to content

Commit

Permalink
feat(section title): add a component for section headings
Browse files Browse the repository at this point in the history
  • Loading branch information
velrest committed Jun 30, 2020
1 parent fe09023 commit e0437bf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addon/components/section-title.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="uk-flex uk-flex-between uk-flex-middle">
<h2 class="uk-margin-remove">
{{t (concat "emeis." @model ".title")}}
</h2>
{{#unless @noCreateLink}}
<LinkTo @route="{{@model}}.new" class="uk-button uk-button-primary" data-test-new>
{{t (concat "emeis." @model ".new")}}
</LinkTo>
{{/unless}}
</div>
<hr />
1 change: 1 addition & 0 deletions app/components/section-title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "ember-emeis/components/section-title";
18 changes: 18 additions & 0 deletions tests/integration/components/section-title-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { setupRenderingTest } from "ember-qunit";
import { module, test } from "qunit";

module("Integration | Component | section-title", function (hooks) {
setupRenderingTest(hooks);

test("it renders", async function (assert) {
const intl = this.owner.lookup("service:intl");
intl.set("locale", "en");

await render(hbs`<SectionTitle @model="roles"/>`);

assert.dom("h2").hasText("Roles");
assert.dom("[data-test-new]").hasText("Add Role");
});
});

0 comments on commit e0437bf

Please sign in to comment.