Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update skills list #1437

Merged
merged 1 commit into from
Nov 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/components/user/skills-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Component from '@ember/component';

export default Component.extend({
classNames: ['user__skills-list'],

user: null
});
1 change: 1 addition & 0 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
@import "components/settings-menu";
@import "components/signup-form";
@import "components/user-details";
@import "components/user/skills-list";

@import "components/user-menu";
// dropdown-menu has to come after user-menu for styles to work correctly
Expand Down
16 changes: 0 additions & 16 deletions app/styles/components/user-details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
&__main {
@include span-columns(9);
}

&__skills-list {
ul {
margin-top: 10px;

li {
background: #E8EBED;
border-radius: 2px;
color: #333;
display: inline-flex;
font-weight: 600;
margin: 0 2px 5px 0;
padding: 4px 7px;
}
}
}
}

.empty-state {
Expand Down
21 changes: 1 addition & 20 deletions app/styles/components/user-list-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,8 @@
}
}
&__skills {
color: $text--lightest;
font-size: $body-font-size-small;
@include span-columns(6);
ul {
margin-top: 6px;
}
li {
display: inline-block;
&:after {
content: ", ";
}
&:last-child {
// confused by the selector below
&:not(:first-child):before {
content: "and ";
}
&:after {
content: ".";
}
}
}
font-size: $body-font-size-small;
}
}

Expand Down
16 changes: 16 additions & 0 deletions app/styles/components/user/skills-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.user__skills-list {
ul {
align-items: flex-start;
display: flex;
margin-top: 10px;

li {
background: #E8EBED;
border-radius: 2px;
color: #333;
font-weight: 600;
margin-right: 5px;
padding: 4px 7px;
}
}
}
6 changes: 1 addition & 5 deletions app/templates/components/user-details.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
<div class="user-details__skills-list">
<h3>Skills</h3>
{{#if user.userSkills}}
<ul data-test-user-skills-list>
{{#each user.userSkills as |userSkill|}}
<li data-test-user-skills-list-item>{{userSkill.skill.title}}</li>
{{/each}}
</ul>
{{user/skills-list data-test-user-skills-list user=user}}
{{else}}
<p data-test-user-skills-list-empty-state class="empty-state">
<strong>{{user.username}}</strong> hasn't added any skills yet.
Expand Down
6 changes: 1 addition & 5 deletions app/templates/components/user-list-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@

<div class="project-user__skills">
<h4>Skills</h4>
<ul>
{{#each user.userSkills as |userSkill|}}
<li>{{userSkill.skill.title}}</li>
{{/each}}
</ul>
{{user/skills-list data-test-user-skills-list user=user}}
</div>

<div class="project-user__actions">
Expand Down
5 changes: 5 additions & 0 deletions app/templates/components/user/skills-list.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ul>
{{#each user.userSkills as |userSkill|}}
<li data-test-user-skills-list-item>{{userSkill.skill.title}}</li>
{{/each}}
</ul>
43 changes: 43 additions & 0 deletions tests/integration/components/user/skills-list-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import PageObject from 'ember-cli-page-object';
import userSkillsList from 'code-corps-ember/tests/pages/components/user/skills-list';

let page = PageObject.create(userSkillsList);

let user = {
userSkills: [
{
skill: {
title: 'Ember.js'
}
},
{
skill: {
title: 'JavaScript'
}
}
]
};

moduleForComponent('user/skills-list', 'Integration | Component | user/skills list', {
integration: true,
beforeEach() {
page.setContext(this);
},
afterEach() {
page.removeContext();
}
});

test('it renders each skill in the list', function(assert) {
assert.expect(3);

this.set('user', user);

page.render(hbs`{{user/skills-list user=user}}`);

assert.equal(page.listItems().count, 2);
assert.equal(page.listItems(0).text, 'Ember.js');
assert.equal(page.listItems(1).text, 'JavaScript');
});
11 changes: 11 additions & 0 deletions tests/pages/components/user/skills-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
collection
} from 'ember-cli-page-object';

export default {
scope: '.user__skills-list',

listItems: collection({
itemScope: '[data-test-user-skills-list-item]'
})
};