Skip to content

Commit

Permalink
Rename to thank-you; update BEM; update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshsmith committed Nov 29, 2016
1 parent e087831 commit 3d6457b
Show file tree
Hide file tree
Showing 23 changed files with 142 additions and 168 deletions.
9 changes: 9 additions & 0 deletions app/components/thank-you-container.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ember from 'ember';

const {
Component
} = Ember;

export default Component.extend({
classNames: ['thank-you-container']
});
17 changes: 0 additions & 17 deletions app/components/thankyou-container.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/project/donate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default Controller.extend({

_transitionToThankYou() {
let project = get(this, 'project');
return this.transitionToRoute('project.thankyou', project);
return this.transitionToRoute('project.thank-you', project);
},

_handleError(error) {
Expand Down
2 changes: 1 addition & 1 deletion app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ AppRouter.map(function() {
this.route('task', { path: '/:number' });
});
this.route('donate');
this.route('thankyou');
this.route('thank-you');
});

this.route('projects', {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
@import "templates/about";
@import "templates/oauth-stripe";
@import "templates/project/index";
@import "templates/project/thankyou";
@import "templates/project/thank-you";
@import "templates/project/settings/contributors";
@import "templates/start/expertise";
@import "templates/start/hello";
Expand Down
29 changes: 29 additions & 0 deletions app/styles/templates/project/thank-you.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.thank-you-container {
margin: 3em;
text-align: center;

&__project-icon {
$file: "/assets/images/icons/fireworks-large";
$height: 100px;
$width: 100px;
@include background-image-retina($file, "png", $height, $width);
display: block;
height: $height;
margin: 1.4em auto;
width: $width;
}

h3 {
font-size: $header-font-size-large;
font-weight: 600;
margin: 10px 0;
}

p {
margin-bottom: 1.4em;
}

&__message {
color: $light-text;
}
}
27 changes: 0 additions & 27 deletions app/styles/templates/project/thankyou.scss

This file was deleted.

10 changes: 10 additions & 0 deletions app/templates/components/thank-you-container.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="thank-you-container__project-icon" data-test-selector="project icon"></div>
<h3>Thank you!</h3>
<div class="thank-you-container__message">
<p data-test-selector="thank you message">
From all the volunteers on the {{project.title}} team.
</p>
<p>
{{link-to "Back to project" "project" project.organization.slug project.slug}}
</p>
</div>
4 changes: 0 additions & 4 deletions app/templates/components/thankyou-container.hbs

This file was deleted.

2 changes: 2 additions & 0 deletions app/templates/project/thank-you.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{project-header project=model}}
{{thank-you-container project=model}}
2 changes: 0 additions & 2 deletions app/templates/project/thankyou.hbs

This file was deleted.

Binary file added public/assets/images/icons/fireworks-large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/acceptance/project-donate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test('Allows adding a card and donating (creating a subscription)', function(ass
assert.ok(subscription, 'Subscription was created sucessfully.');
assert.equal(subscription.userId, user.id, 'User was set to current user.');
assert.equal(subscription.projectId, project.id, 'Project was set to current project.');
assert.equal(currentRouteName(), 'project.thankyou', 'User was redirected to the thank you route.');
assert.equal(currentRouteName(), 'project.thank-you', 'User was redirected to the thank you route.');
});
});

Expand Down
49 changes: 49 additions & 0 deletions tests/acceptance/project-thank-you-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { test } from 'qunit';
import moduleForAcceptance from 'code-corps-ember/tests/helpers/module-for-acceptance';

import { authenticateSession } from 'code-corps-ember/tests/helpers/ember-simple-auth';
import createProjectWithSluggedRoute from 'code-corps-ember/tests/helpers/mirage/create-project-with-slugged-route';
import projectThankYouPage from '../pages/project/thank-you';

moduleForAcceptance('Acceptance | Project - thank-you');

test('It requires authentication', function(assert) {
assert.expect(1);

let project = createProjectWithSluggedRoute();
let { organization } = project;

projectThankYouPage.visit({
organization: organization.slug,
project: project.slug
});

andThen(() => {
assert.equal(currentRouteName(), 'login');
});
});

test('It directs you to the project when done', function(assert) {
assert.expect(2);

let user = server.create('user');
authenticateSession(this.application, { 'user_id': user.id });

let project = createProjectWithSluggedRoute();
let { organization } = project;

projectThankYouPage.visit({
organization: organization.slug,
project: project.slug
});

andThen(() => {
assert.ok(projectThankYouPage.thankYouContainer.isVisible, 'The thank you container component renders.');

projectThankYouPage.thankYouContainer.clickLink();
});

andThen(() => {
assert.equal(currentRouteName(), 'project.index', 'Link leads to project page.');
});
});
52 changes: 0 additions & 52 deletions tests/acceptance/project-thankyou-test.js

This file was deleted.

25 changes: 25 additions & 0 deletions tests/integration/components/thank-you-container-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import PageObject from 'ember-cli-page-object';
import thankYouContainerComponent from '../../pages/components/thank-you-container';

let page = PageObject.create(thankYouContainerComponent);

moduleForComponent('thank-you-container', 'Integration | Component | thank-you container', {
integration: true,
beforeEach() {
this.set('project', {
id: 42,
title: 'A Test Project'
});

page.setContext(this);
page.render(hbs`{{thank-you-container project=project}}`);
}
});

test('it renders the thank you text', function(assert) {
assert.expect(1);

assert.equal(page.thankYouText, `From all the volunteers on the ${this.get('project.title')} team.`);
});
36 changes: 0 additions & 36 deletions tests/integration/components/thankyou-container-test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import {
attribute,
clickable,
text
} from 'ember-cli-page-object';

export default {
scope: '.thank-you-container',

icon: {
scope: '[data-test-selector="project icon"]',
alt: attribute('alt'),
src: attribute('src')
scope: '[data-test-selector="project icon"]'
},

clickLink: clickable('a'),

thankYouText: text('[data-test-selector="thank you message"]')
};
8 changes: 8 additions & 0 deletions tests/pages/project/thank-you.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { create, visitable } from 'ember-cli-page-object';
import thankYouContainer from 'code-corps-ember/tests/pages/components/thank-you-container';

export default create({
visit: visitable(':organization/:project/thank-you'),

thankYouContainer
});
12 changes: 0 additions & 12 deletions tests/pages/project/thankyou.js

This file was deleted.

10 changes: 0 additions & 10 deletions tests/unit/routes/project/thankyou-test.js

This file was deleted.

0 comments on commit 3d6457b

Please sign in to comment.