Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
b7f297ed
Commit
b7f297ed
authored
Nov 22, 2016
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace static fixture for abuse_reports_spec (!7644)
parent
01ffcceb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
34 deletions
+51
-34
changelogs/unreleased/abuse_report-fixture.yml
changelogs/unreleased/abuse_report-fixture.yml
+4
-0
spec/javascripts/abuse_reports_spec.js.es6
spec/javascripts/abuse_reports_spec.js.es6
+20
-18
spec/javascripts/fixtures/abuse_reports.html.haml
spec/javascripts/fixtures/abuse_reports.html.haml
+0
-16
spec/javascripts/fixtures/abuse_reports.rb
spec/javascripts/fixtures/abuse_reports.rb
+27
-0
No files found.
changelogs/unreleased/abuse_report-fixture.yml
0 → 100644
View file @
b7f297ed
---
title
:
Replace static fixture for abuse_reports_spec
merge_request
:
7644
author
:
winniehell
spec/javascripts/abuse_reports_spec.js.es6
View file @
b7f297ed
/* eslint-disable space-before-function-paren, no-new, padded-blocks */
/*= require lib/utils/text_utility */
/*= require abuse_reports */
/*= require jquery */
((global) => {
const FIXTURE = 'abuse_reports.html';
const MAX_MESSAGE_LENGTH = 500;
describe('Abuse Reports', () => {
const FIXTURE = 'abuse_reports/abuse_reports_list.html.raw';
const MAX_MESSAGE_LENGTH = 500;
let messages;
function assertMaxLength($message) {
expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
}
const assertMaxLength = $message => expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
const findMessage = searchText => messages.filter(
(index, element) => element.innerText.indexOf(searchText) > -1,
).first();
describe('Abuse Reports', function() {
fixture.preload(FIXTURE);
beforeEach(function() {
beforeEach(function
() {
fixture.load(FIXTURE);
new global.AbuseReports();
this.abuseReports = new global.AbuseReports();
messages = $('.abuse-reports .message');
});
it('should truncate long messages', function() {
const $longMessage = $('#long');
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',
function()
{
const $shortMessage =
$('#short
');
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',
function()
{
const $longMessage =
$('#long
');
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);
});
});
})(window.gl);
spec/javascripts/fixtures/abuse_reports.html.haml
deleted
100644 → 0
View file @
01ffcceb
.abuse-reports
.message
#long
Cat ipsum dolor sit amet, hide head under blanket so no one can see.
Gate keepers of hell eat and than sleep on your face but hunt by meowing
loudly at 5am next to human slave food dispenser cats go for world
domination or chase laser, yet poop on grasses chirp at birds. Cat is love,
cat is life chase after silly colored fish toys around the house climb a
tree, wait for a fireman jump to fireman then scratch his face fall asleep
on the washing machine lies down always hungry so caticus cuteicus. Sit on
human. Spot something, big eyes, big eyes, crouch, shake butt, prepare to
pounce sleep in the bathroom sink hiss at vacuum cleaner hide head under
blanket so no one can see throwup on your pillow.
.message
#short
Cat ipsum dolor sit amet, groom yourself 4 hours - checked, have your
beauty sleep 18 hours - checked, be fabulous for the rest of the day -
checked! for shake treat bag.
spec/javascripts/fixtures/abuse_reports.rb
0 → 100644
View file @
b7f297ed
require
'spec_helper'
describe
Admin
::
AbuseReportsController
,
'(JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
let
(
:admin
)
{
create
(
:admin
)
}
let!
(
:abuse_report
)
{
create
(
:abuse_report
)
}
let!
(
:abuse_report_with_short_message
)
{
create
(
:abuse_report
,
message:
'SHORT MESSAGE'
)
}
let!
(
:abuse_report_with_long_message
)
{
create
(
:abuse_report
,
message:
"LONG MESSAGE
\n
"
*
50
)
}
render_views
before
(
:all
)
do
clean_frontend_fixtures
(
'abuse_reports/'
)
end
before
(
:each
)
do
sign_in
(
admin
)
end
it
'abuse_reports/abuse_reports_list.html.raw'
do
|
example
|
get
:index
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment