Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-01-09 15:58:05 +0300
committerPhil Hughes <me@iamphill.com>2018-01-11 11:55:17 +0300
commit3b9a1f36ee4af34fdcb82a29537d8ef20cb67270 (patch)
tree0f973cfcfe696d6dd2f0ef9b55f41eef41e9bb98 /spec/javascripts/pages
parenta607f343c5c28511e92e058a9556b89f897ae8c2 (diff)
fixed abuse_reports spec
Diffstat (limited to 'spec/javascripts/pages')
-rw-r--r--spec/javascripts/pages/admin/abuse_reports/abuse_reports_spec.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/javascripts/pages/admin/abuse_reports/abuse_reports_spec.js b/spec/javascripts/pages/admin/abuse_reports/abuse_reports_spec.js
new file mode 100644
index 00000000000..d2386077aa6
--- /dev/null
+++ b/spec/javascripts/pages/admin/abuse_reports/abuse_reports_spec.js
@@ -0,0 +1,41 @@
+import '~/lib/utils/text_utility';
+import AbuseReports from '~/pages/admin/abuse_reports/abuse_reports';
+
+describe('Abuse Reports', () => {
+ const FIXTURE = 'abuse_reports/abuse_reports_list.html.raw';
+ const MAX_MESSAGE_LENGTH = 500;
+
+ let $messages;
+
+ const assertMaxLength = $message => expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
+ const findMessage = searchText => $messages.filter(
+ (index, element) => element.innerText.indexOf(searchText) > -1,
+ ).first();
+
+ preloadFixtures(FIXTURE);
+
+ beforeEach(function () {
+ loadFixtures(FIXTURE);
+ this.abuseReports = new AbuseReports();
+ $messages = $('.abuse-reports .message');
+ });
+
+ it('should truncate long messages', () => {
+ const $longMessage = findMessage('LONG MESSAGE');
+ expect($longMessage.data('original-message')).toEqual(jasmine.anything());
+ assertMaxLength($longMessage);
+ });
+
+ it('should not truncate short messages', () => {
+ const $shortMessage = findMessage('SHORT MESSAGE');
+ expect($shortMessage.data('original-message')).not.toEqual(jasmine.anything());
+ });
+
+ it('should allow clicking a truncated message to expand and collapse the full message', () => {
+ const $longMessage = findMessage('LONG MESSAGE');
+ $longMessage.click();
+ expect($longMessage.data('original-message').length).toEqual($longMessage.text().length);
+ $longMessage.click();
+ assertMaxLength($longMessage);
+ });
+});