summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/change/gr-message/gr-message_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'polygerrit-ui/app/elements/change/gr-message/gr-message_test.html')
-rw-r--r--polygerrit-ui/app/elements/change/gr-message/gr-message_test.html29
1 files changed, 24 insertions, 5 deletions
diff --git a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.html b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.html
index aa18c4e7b6..870f366fa6 100644
--- a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.html
+++ b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<!--
+@license
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -163,22 +164,40 @@ limitations under the License.
});
});
- test('negative vote', () => {
+ test('votes', () => {
element.message = {
author: {},
expanded: false,
message: 'Patch Set 1: Verified+1 Code-Review-2 Trybot-Ready+1',
};
- assert.isOk(Polymer.dom(element.root).querySelector('.negativeVote'));
+ element.labelExtremes = {
+ 'Verified': {max: 1, min: -1},
+ 'Code-Review': {max: 2, min: -2},
+ 'Trybot-Ready': {max: 3, min: 0},
+ };
+ flushAsynchronousOperations();
+ const scoreChips = Polymer.dom(element.root).querySelectorAll('.score');
+ assert.equal(scoreChips.length, 3);
+
+ assert.isTrue(scoreChips[0].classList.contains('positive'));
+ assert.isTrue(scoreChips[0].classList.contains('max'));
+
+ assert.isTrue(scoreChips[1].classList.contains('negative'));
+ assert.isTrue(scoreChips[1].classList.contains('min'));
+
+ assert.isTrue(scoreChips[2].classList.contains('positive'));
+ assert.isFalse(scoreChips[2].classList.contains('min'));
});
- test('positive vote', () => {
+ test('false negative vote', () => {
element.message = {
author: {},
expanded: false,
- message: 'Patch Set 1: Verified-1 Code-Review+2 Trybot-Ready-1',
+ message: 'Patch Set 1: Cherry Picked from branch stable-2.14.',
};
- assert.isOk(Polymer.dom(element.root).querySelector('.positiveVote'));
+ element.labelExtremes = {};
+ const scoreChips = Polymer.dom(element.root).querySelectorAll('.score');
+ assert.equal(scoreChips.length, 0);
});
});
</script>