Skip to content

Commit

Permalink
Set prepend by default to true (#132) ❤️ @ondrejsevcik
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-evans authored Nov 7, 2018
2 parents 7b571bf + a908cb2 commit 4732cdb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ This file is added automatically if you use `ember install`. This is for all the

| attribute | type | default |
|-----------|:--------|:--------|
| separator | string | `" \| "` |
| prepend | boolean | false |
| separator | string | `" \| "`|
| prepend | boolean | true |
| replace | boolean | false |

These defaults are configurable in `config/environment.js`:
Expand Down
4 changes: 2 additions & 2 deletions addon/services/page-title-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export default Service.extend({
The default prepend value to use.
@property defaultPrepend
@default null
@default true
*/
defaultPrepend: null,
defaultPrepend: true,

/**
The default replace value to use.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/acceptance/posts-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module('Acceptance: title', function(hooks) {
assert.expect(1);
await visit('/posts');

assert.equal(title(), 'My App | Posts');
assert.equal(title(), 'Posts | My App');
});

test('the replace attribute works', async function (assert) {
Expand All @@ -30,28 +30,28 @@ module('Acceptance: title', function(hooks) {
assert.expect(1);
await visit('/about/authors');

assert.equal(title(), 'About My App > Authors');
assert.equal(title(), 'Authors > About My App');
});

test('custom separators are inherited', async function (assert) {
assert.expect(1);
await visit('/about/authors/profile');

assert.equal(title(), 'About My App > Authors > Profile');
assert.equal(title(), 'Profile > Authors > About My App');
});

test('multiple components in a row work', async function (assert) {
assert.expect(1);
await visit('/posts/rails-is-omakase');

assert.equal(title(), 'My App | Posts | Rails is Omakase');
assert.equal(title(), 'Rails is Omakase | Posts | My App');
});

test('the prepend declaration works', async function (assert) {
test('the prepend=false declaration works', async function (assert) {
assert.expect(1);
await visit('/authors/tomster');

assert.equal(title(), 'My App | Tomster < Authors');
assert.equal(title(), 'My App | Authors < Tomster');
});

test('replace nested in prepends work', async function (assert) {
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/author.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{title "Authors" prepend=true separator=' < '}}
{{title "Authors" prepend=false separator=' < '}}
{{title model.name}}
10 changes: 5 additions & 5 deletions tests/unit/services/page-title-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ module('service:page-title-list', function(hooks) {

let tokens = list.get('sortedTokens');
assert.equal(tokens.length, 2);
assert.equal(tokens[0].id, 2);
assert.equal(tokens[1].id, 3);
assert.equal(tokens[0].id, 3);
assert.equal(tokens[1].id, 2);
});

test('removing a token with replace: true will set all previous tokens to be visible', function (assert) {
Expand All @@ -150,8 +150,8 @@ module('service:page-title-list', function(hooks) {

let tokens = list.get('sortedTokens');
assert.equal(tokens.length, 2);
assert.equal(tokens[0].id, 1);
assert.equal(tokens[1].id, 3);
assert.equal(tokens[0].id, 3);
assert.equal(tokens[1].id, 1);
});

test('removing a token with replace: true will only set previous tokens up to the last replace: true to visible', function (assert) {
Expand Down Expand Up @@ -180,6 +180,6 @@ module('service:page-title-list', function(hooks) {
list.push(second);
list.push(third);

assert.equal(list.toString(), '1 | 3');
assert.equal(list.toString(), '3 | 1');
});
});

0 comments on commit 4732cdb

Please sign in to comment.