-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add conversation-part-closed component #1638
Changes from 1 commit
c9115be
bd476e4
7da31f3
e5f797d
600c518
368686b
36220d5
f11705c
8ec511b
955cea9
27f5947
6de8ba1
372f93e
4144f99
9f5c0da
a3f219e
b18b605
f03c50c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
<div class="coversation-part-closed__message-wrapper"> | ||
{{#if currentUser}} | ||
You closed this at... You closed this at {{moment-format conversationPart.updatedAt 'MM/DD/YYYY hh:mm:ss'}} | ||
<div class="conversation-part-closed__timestamps-wrapper"> | ||
<div class="conversation-part-closed__timestamps"> | ||
<span data-test-closed-at> | ||
{{#if isSelf}} | ||
You closed this at {{moment-format conversationPart.updatedAt 'MM/DD/YYYY hh:mm:ss'}} | ||
{{else}} | ||
<div class="conversation-part-closed__message-wrapper"> | ||
{{author.username}} closed this at {{moment-format conversationPart.updatedAt 'MM/DD/YYYY hh:mm:ss'}} | ||
{{/if}} | ||
{{/if}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation error here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still have this indentation error, It starts at line 5, if it's not clear. The whole if-else chunk needs to be indented 3 levels deeper. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You still have an indentation error here. |
||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In line with my comment above, you can remove all the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import PageObject from 'ember-cli-page-object'; | ||
import component from 'code-corps-ember/tests/pages/components/conversations/conversation-part-closed'; | ||
import stubService from 'code-corps-ember/tests/helpers/stub-service'; | ||
|
||
let page = PageObject.create(component); | ||
|
||
function renderPage() { | ||
page.render(hbs` | ||
{{conversations/conversation-part-closed | ||
author=author | ||
closedAt=closedAt | ||
}} | ||
`); | ||
|
||
moduleForComponent('conversations/conversation-part-closed', 'Integration | Component | conversations/conversation part closed', { | ||
integration: true | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would love feedback on test statements on 21 + 25. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For future reference, you should comment below those lines so we can see them in this view. Also, would be helpful to have some direction in terms of what you want feedback on specifically? |
||
test('if user closes message, "You closed this at" is rendered', function(assert){ | ||
|
||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These blank tests seems like they would test correct behavior, so the thinking is probably sound. Just need to implement them. |
||
|
||
test('if user looks at closed message they did not close, "author.username" is rendered', function(assert){ | ||
|
||
}) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the life of me, I can't figure out how to get the timestamp to pass in and have been working on it for an very inefficient length of time, by that I mean all day. This thing has kicked my ass to and fro and I'm sick of looking at it and am going to move to something else so the day isn't a complete wash. Nikola has stepped in a bunch with some guidance, but it didn't seem to help my stupidity. |
||
test('it renders', function(assert) { | ||
|
||
// Set any properties with this.set('myProperty', 'value'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import { | ||
text | ||
hasClass | ||
} from 'ember-cli-page-object'; | ||
|
||
export default { | ||
title: text('h1') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also love feed back on page object. Think I have everything I need though, at least that I've found I need so far. |
||
|
||
scope: '.conversation-part-closed', | ||
|
||
closedAt: { | ||
scope: '[data-test-closed-at]' | ||
}, | ||
|
||
sentByCurrentUser: hasClass('conversation-part-closed--is-self') | ||
|
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two problems here
It's not clear what
author
isYou specify the value of author through the
.hbs
, as exampled in the test module you wrote:When we do that, we also add that property into the
.js
and give it a default value, usuallynull
, unless some other value makes sense. You already did this withclosedAt: null
, so you should do the same withauthor: null
.The code will work regardless, but we do this so that, when someone is reading the
.js
, they do not need to navigate back and forth between the.js
and the.hbs
and the component is relatively clear from the.hbs
alone.user
is not defined at allThe
author
is whichever user is responsible for this specific conversation part being created.The
user
is supposed to be whichever user is currently signed in to the app. You get it from thecurrentUser
service ascurrentUser.user
, so to have it available to you as justuser
, you need to define an alias. You can look at the basicconversation-part-comment
component to see how that's done.