Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 200dcc2

Browse files
committed
add/modify some tests
1 parent cc3d925 commit 200dcc2

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

lib/controllers/reviews-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import unresolveReviewThreadMutation from '../mutations/unresolve-review-thread'
1414
import IssueishDetailItem from '../items/issueish-detail-item';
1515
import {addEvent} from '../reporter-proxy';
1616

17-
// Milliseconds to leave scrollToThreadID non-null before reverting.
17+
// Milliseconds to update highlightedThreadIDs
1818
const FLASH_DELAY = 1500;
1919

2020
export class BareReviewsController extends React.Component {

lib/views/reviews-view.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ export default class ReviewsView extends React.Component {
649649
return {lineNumber, positionText};
650650
}
651651

652+
/* istanbul ignore next */
652653
scrollToThread(threadID) {
653654
const threadHolder = this.threadHolders.get(threadID);
654655
if (threadHolder) {

test/controllers/reviews-controller.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,22 @@ describe('ReviewsController', function() {
9595
assert.strictEqual(opWrapper.find(ReviewsView).prop('extra'), extra);
9696
});
9797

98-
it('scrolls to a specific thread on mount', function() {
98+
it('scrolls to and highlight a specific thread on mount', function() {
9999
clock = sinon.useFakeTimers();
100100
const wrapper = shallow(buildApp({initThreadID: 'thread0'}));
101101
let opWrapper = wrapper.find(PullRequestCheckoutController).renderProp('children')(noop);
102102

103103
assert.include(opWrapper.find(ReviewsView).prop('threadIDsOpen'), 'thread0');
104+
assert.include(opWrapper.find(ReviewsView).prop('highlightedThreadIDs'), 'thread0');
104105
assert.strictEqual(opWrapper.find(ReviewsView).prop('scrollToThreadID'), 'thread0');
105106

106107
clock.tick(2000);
107108
opWrapper = wrapper.find(PullRequestCheckoutController).renderProp('children')(noop);
109+
assert.notInclude(opWrapper.find(ReviewsView).prop('highlightedThreadIDs'), 'thread0');
108110
assert.isNull(opWrapper.find(ReviewsView).prop('scrollToThreadID'));
109111
});
110112

111-
it('scrolls to a specific thread on update', function() {
113+
it('scrolls to and highlight a specific thread on update', function() {
112114
clock = sinon.useFakeTimers();
113115
const wrapper = shallow(buildApp());
114116
let opWrapper = wrapper.find(PullRequestCheckoutController).renderProp('children')(noop);
@@ -118,11 +120,13 @@ describe('ReviewsController', function() {
118120
opWrapper = wrapper.find(PullRequestCheckoutController).renderProp('children')(noop);
119121

120122
assert.include(opWrapper.find(ReviewsView).prop('threadIDsOpen'), 'hang-by-a-thread');
123+
assert.include(opWrapper.find(ReviewsView).prop('highlightedThreadIDs'), 'hang-by-a-thread');
121124
assert.isTrue(opWrapper.find(ReviewsView).prop('commentSectionOpen'));
122125
assert.strictEqual(opWrapper.find(ReviewsView).prop('scrollToThreadID'), 'hang-by-a-thread');
123126

124127
clock.tick(2000);
125128
opWrapper = wrapper.find(PullRequestCheckoutController).renderProp('children')(noop);
129+
assert.notInclude(opWrapper.find(ReviewsView).prop('highlightedThreadIDs'), 'hang-by-a-thread');
126130
assert.isNull(opWrapper.find(ReviewsView).prop('scrollToThreadID'));
127131
});
128132

test/views/reviews-view.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ describe('ReviewsView', function() {
292292
assert.strictEqual(comment.find('em').text(), 'This comment was hidden');
293293
});
294294

295+
it('groups comments by their resolved status', function() {
296+
const unresolvedThreads = wrapper.find('.github-Reviews-section.comments').find('.github-Review');
297+
const resolvedThreads = wrapper.find('.github-Reviews-section.resolved-comments').find('.github-Review');
298+
assert.lengthOf(resolvedThreads, 1);
299+
assert.lengthOf(unresolvedThreads, 3);
300+
});
301+
295302
describe('indication that a comment has been edited', function() {
296303
it('indicates that a review summary comment has been edited', function() {
297304
const summary = wrapper.find('.github-ReviewSummary').at(0);

0 commit comments

Comments
 (0)