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

Add conversation status selector #1647

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

joshsmith
Copy link
Contributor

@joshsmith joshsmith commented Dec 21, 2017

What's in this PR?

Add a selector to change the conversation status.

Needs tests.

References

Progress on: #1632

@joshsmith joshsmith force-pushed the 1632-add-conversation-status-select branch from ae3dcb0 to 2d031b3 Compare December 22, 2017 00:44
@joshsmith joshsmith requested a review from snewcomer December 22, 2017 00:46
Copy link
Contributor

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely work!

let controller = this.controllerFor('project.conversations');
controller.set('currentlyLoading', true);
let that = this;
transition.promise.finally(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can a hash rocket be used here?


set(this, 'status', 'open');

renderPage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does renderPage need an away? I'm guessing not since this passes, but have seen await with render in the new qunit api

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might need it of we're setting a component property without wrapping it in a run. Someone ought to try that out.

@@ -214,11 +212,28 @@ test('Project admin can reopen a conversation', function(assert) {
project: project.slug
});

andThen(() => {
page.statusSelect.openButton.click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new async await would be rid of the andThens'. I'm sure you already know that but I found it was useful to start moving acceptance tests over 1 test file at a time (maybe a codemod) available now???

queryParams: ['status'],
status: 'open',

currentlyLoading: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want the default to be false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, since it could result in some weird state.

@joshsmith joshsmith requested a review from begedin December 22, 2017 08:23
transition.promise.finally(function() {
controller.set('currentlyLoading', false);
that.transitionTo('project.conversations.index');
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using an arrow function should eliminate the need for that

if (get(conversations, 'length') > 0) {
this.transitionTo('project.conversations.conversation', get(conversations, 'firstObject'));
let sortedConversations
= conversations.filterBy('status', status).sortBy('updatedAt');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to filter here, right? The model should already be filtered. If it's not, then we should add a comment as to why that is.

You do need to sort, but not until you know the array isn't empty. That shouldn't matter much, though. Sorting a blank array is not expensive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering does need to happen since the model does not necessarily update when an individual conversation changes.


set(this, 'status', 'open');

renderPage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might need it of we're setting a component property without wrapping it in a run. Someone ought to try that out.

Copy link
Contributor

@begedin begedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Did not realize about the filtering.

@joshsmith joshsmith force-pushed the 1632-add-conversation-status-select branch from 8bdce3c to 2c3455f Compare December 22, 2017 18:31
andThen(() => {
page.conversations(1).click();
});
page.conversations(1).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await here as well? I thik it may b/c click is an async test helper.

https://github.com/san650/ember-cli-page-object/blob/master/addon/-private/properties/clickable.js#L68

andThen(() => {
page.conversations(0).click();
});
page.conversations(0).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@joshsmith joshsmith merged commit 15e2cf5 into develop Dec 22, 2017
@joshsmith joshsmith deleted the 1632-add-conversation-status-select branch December 22, 2017 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants