From 4bff914df31ba037d8e8ac91a8522202d308ce0a Mon Sep 17 00:00:00 2001 From: Andrew Bonventre Date: Thu, 7 Jan 2016 21:05:30 -0500 Subject: [PATCH] Add regression test for file list comment string filtering bug Change-Id: Ibc349de1c73c015b12f5fc4cc992be1eb0109540 --- polygerrit-ui/app/test/gr-file-list-test.html | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/polygerrit-ui/app/test/gr-file-list-test.html b/polygerrit-ui/app/test/gr-file-list-test.html index f474f15c35..8c099c017d 100644 --- a/polygerrit-ui/app/test/gr-file-list-test.html +++ b/polygerrit-ui/app/test/gr-file-list-test.html @@ -120,7 +120,42 @@ limitations under the License. ['/COMMIT_MSG', 'file_added_in_rev2.txt', 'myfile.txt']); done(); }, 1); - }, 1) + }, 1); + }); + + test('comment filtering', function() { + var comments = { + '/COMMIT_MSG': [ + { patch_set: 1, message: 'Done' }, + { patch_set: 1, message: 'oh hay' }, + { patch_set: 2, message: 'hello' }, + ], + 'myfile.txt': [ + { patch_set: 1, message: 'good news!' }, + { patch_set: 2, message: 'wat!?' }, + { patch_set: 2, message: 'hi' }, + ], + }; + assert.equal( + element._computeCommentsString(comments, '1', '/COMMIT_MSG'), + '2 comments'); + assert.equal( + element._computeCommentsString(comments, '1', 'myfile.txt'), + '1 comment'); + assert.equal( + element._computeCommentsString(comments, '1', + 'file_added_in_rev2.txt'), + ''); + assert.equal( + element._computeCommentsString(comments, '2', '/COMMIT_MSG'), + '1 comment'); + assert.equal( + element._computeCommentsString(comments, '2', 'myfile.txt'), + '2 comments'); + assert.equal( + element._computeCommentsString(comments, '2', + 'file_added_in_rev2.txt'), + ''); }); });