refactor: 💡 replace layout regions with anonymous component

This commit is contained in:
Randall Morey committed 2020-06-10 14:21:26 -04:00
1 parent 45af417372
commit 2c295afdfd
47 files changed
+108 -362

No files matched your search

@@ -1,5 +1,5 @@
<Rose::Layout::Global as |global|>
<global.header>
<Rose::Layout::Global as |layout|>
<layout.header>
<Rose::Header as |header|>
<header.brand @logo="logo" @text="Product Name" />
@@ -28,18 +28,18 @@
</header.utilities>
</Rose::Header>
</global.header>
</layout.header>
<global.navigation>
<layout.sidebar>
<Rose::Nav::Sidebar @title="Title" as |nav|>
<nav.link @route="index">Item Name</nav.link>
<nav.link @route="about">Item Name</nav.link>
<nav.link @route="about">Item Name</nav.link>
<nav.link @route="about">Item Name</nav.link>
</Rose::Nav::Sidebar>
</global.navigation>
</layout.sidebar>
<global.body>
<layout.body>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>Breadcrumbs</page.breadcrumbs>
<page.header>Header</page.header>
@@ -229,5 +229,5 @@
</footer.row>
</table.footer>
</Rose::Table>
</global.body>
</layout.body>
</Rose::Layout::Global>
@@ -0,0 +1,18 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/anonymous', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
await render(hbs`
{{#rose/anonymous tagName='main'}}
template block text
{{/rose/anonymous}}
`);
assert.ok(find('main'));
assert.equal(this.element.textContent.trim(), 'template block text');
});
});
@@ -18,30 +18,30 @@ module('Integration | Component | rose/layout/global', function (hooks) {
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Global as |global|>
await render(hbs`<Rose::Layout::Global as |layout|>
<button id="content" />
</Rose::Layout::Global>`);
assert.ok(find('#content'));
});
test('it renders with header', async function (assert) {
await render(hbs`<Rose::Layout::Global as |global|>
<global.header />
await render(hbs`<Rose::Layout::Global as |layout|>
<layout.header />
</Rose::Layout::Global>`);
assert.ok(find('.rose-layout-global-header'));
});
test('it renders with main', async function (assert) {
await render(hbs`<Rose::Layout::Global as |global|>
<global.body />
await render(hbs`<Rose::Layout::Global as |layout|>
<layout.body />
</Rose::Layout::Global>`);
assert.ok(find('.rose-layout-global-body'));
});
test('it renders with sidebar', async function (assert) {
await render(hbs`<Rose::Layout::Global as |global|>
<global.navigation />
await render(hbs`<Rose::Layout::Global as |layout|>
<layout.sidebar />
</Rose::Layout::Global>`);
assert.ok(find('.rose-layout-global-navigation'));
assert.ok(find('.rose-layout-global-sidebar'));
});
});
@@ -1,26 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/global/body', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Global::Body />`);
assert.ok(find('main'));
assert.ok(find('.rose-layout-global-body'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Global::Body id="main"/>`);
assert.ok(find('#main'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Global::Body>
<button id="content" />
</Rose::Layout::Global::Body>`);
assert.ok(find('#content'));
});
});
@@ -1,26 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/global/header', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Global::Header />`);
assert.ok(find('header'));
assert.ok(find('.rose-layout-global-header'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Global::Header id="header"/>`);
assert.ok(find('#header'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Global::Header>
<button id="content" />
</Rose::Layout::Global::Header>`);
assert.ok(find('#content'));
});
});
@@ -1,28 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/global/navigation', function (
hooks
) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Global::Navigation />`);
assert.ok(find('aside'));
assert.ok(find('.rose-layout-global-navigation'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Global::Navigation id="navigation"/>`);
assert.ok(find('#navigation'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Global::Navigation>
<button id="content" />
</Rose::Layout::Global::Navigation>`);
assert.ok(find('#content'));
});
});
@@ -1,26 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/page/actions', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Page::Actions />`);
assert.ok(find('div'));
assert.ok(find('.rose-layout-page-actions'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Page::Actions id="actions"/>`);
assert.ok(find('#actions'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Page::Actions>
<button id="content" />
</Rose::Layout::Page::Actions>`);
assert.ok(find('#content'));
});
});
@@ -1,26 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/page/body', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Page::Body />`);
assert.ok(find('div'));
assert.ok(find('.rose-layout-page-body'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Page::Body id="body"/>`);
assert.ok(find('#body'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Page::Body>
<button id="content" />
</Rose::Layout::Page::Body>`);
assert.ok(find('#content'));
});
});
@@ -1,28 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/page/breadcrumbs', function (
hooks
) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Page::Breadcrumbs />`);
assert.ok(find('div'));
assert.ok(find('.rose-layout-page-breadcrumbs'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Page::Breadcrumbs id="breadcrumbs"/>`);
assert.ok(find('#breadcrumbs'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Page::Breadcrumbs>
<button id="content" />
</Rose::Layout::Page::Breadcrumbs>`);
assert.ok(find('#content'));
});
});
@@ -1,26 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/page/header', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Page::Header />`);
assert.ok(find('div'));
assert.ok(find('.rose-layout-page-header'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Page::Header id="header"/>`);
assert.ok(find('#header'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Page::Header>
<button id="content" />
</Rose::Layout::Page::Header>`);
assert.ok(find('#content'));
});
});
@@ -1,28 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/page/navigation', function (
hooks
) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Page::Navigation />`);
assert.ok(find('div'));
assert.ok(find('.rose-layout-page-navigation'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Page::Navigation id="navigation"/>`);
assert.ok(find('#navigation'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Page::Navigation>
<button id="content" />
</Rose::Layout::Page::Navigation>`);
assert.ok(find('#content'));
});
});