diff options
| author | Sean McGivern <sean@gitlab.com> | 2016-08-18 22:50:28 +0100 |
|---|---|---|
| committer | Sean McGivern <sean@gitlab.com> | 2016-08-18 22:50:28 +0100 |
| commit | aba9cc6f227a670390cbac0c5da97784afefc5ee (patch) | |
| tree | 4eaafa3fb7fc948361a63b8b24170d69bddeeced /spec/javascripts/abuse_reports_spec.js.es6 | |
| parent | 883b96ab6a77175d9bac7f03c325428327359cdd (diff) | |
| parent | 717366d28da11acc6dbe60301bf7e2394400b3c1 (diff) | |
| download | gitlab-ce-aba9cc6f227a670390cbac0c5da97784afefc5ee.tar.gz | |
Merge branch 'master' into expiration-date-on-memberships
Diffstat (limited to 'spec/javascripts/abuse_reports_spec.js.es6')
| -rw-r--r-- | spec/javascripts/abuse_reports_spec.js.es6 | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/javascripts/abuse_reports_spec.js.es6 b/spec/javascripts/abuse_reports_spec.js.es6 new file mode 100644 index 00000000000..6bcfdf191c2 --- /dev/null +++ b/spec/javascripts/abuse_reports_spec.js.es6 @@ -0,0 +1,41 @@ +/*= require abuse_reports */ + +/*= require jquery */ + +((global) => { + const FIXTURE = 'abuse_reports.html'; + const MAX_MESSAGE_LENGTH = 500; + + function assertMaxLength($message) { + expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH); + } + + describe('Abuse Reports', function() { + fixture.preload(FIXTURE); + + beforeEach(function() { + fixture.load(FIXTURE); + new global.AbuseReports(); + }); + + it('should truncate long messages', function() { + const $longMessage = $('#long'); + expect($longMessage.data('original-message')).toEqual(jasmine.anything()); + assertMaxLength($longMessage); + }); + + it('should not truncate short messages', function() { + const $shortMessage = $('#short'); + expect($shortMessage.data('original-message')).not.toEqual(jasmine.anything()); + }); + + it('should allow clicking a truncated message to expand and collapse the full message', function() { + const $longMessage = $('#long'); + $longMessage.click(); + expect($longMessage.data('original-message').length).toEqual($longMessage.text().length); + $longMessage.click(); + assertMaxLength($longMessage); + }); + }); + +})(window.gl); |
