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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
735af14b
Commit
735af14b
authored
Mar 29, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
d9bc0870
b4cc639f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
10 deletions
+47
-10
spec/frontend/.eslintrc.yml
spec/frontend/.eslintrc.yml
+7
-2
spec/frontend/helpers/fixtures.js
spec/frontend/helpers/fixtures.js
+20
-6
spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js
.../frontend/pages/admin/abuse_reports/abuse_reports_spec.js
+2
-2
spec/frontend/test_setup.js
spec/frontend/test_setup.js
+18
-0
No files found.
spec/frontend/.eslintrc.yml
View file @
735af14b
...
...
@@ -2,8 +2,13 @@
env
:
jest/globals
:
true
plugins
:
-
jest
-
jest
settings
:
import/resolver
:
jest
:
jestConfigFile
:
"
jest.config.js"
jestConfigFile
:
'
jest.config.js'
globals
:
getJSONFixture
:
false
loadFixtures
:
false
preloadFixtures
:
false
setFixtures
:
false
spec/frontend/helpers/fixtures.js
View file @
735af14b
/* eslint-disable import/prefer-default-export, global-require, import/no-dynamic-require */
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
...
...
@@ -7,16 +5,32 @@ import { ErrorWithStack } from 'jest-util';
const
fixturesBasePath
=
path
.
join
(
process
.
cwd
(),
'
spec
'
,
'
javascripts
'
,
'
fixtures
'
);
export
function
get
JSONFixture
(
relativePath
,
ee
=
false
)
{
const
absolutePath
=
path
.
join
(
fixturesBasePath
,
ee
?
'
ee
'
:
''
,
relativePath
);
export
function
get
Fixture
(
relativePath
)
{
const
absolutePath
=
path
.
join
(
fixturesBasePath
,
relativePath
);
if
(
!
fs
.
existsSync
(
absolutePath
))
{
throw
new
ErrorWithStack
(
`Fixture file
${
relativePath
}
does not exist.
Did you run bin/rake karma:fixtures?`
,
get
JSON
Fixture
,
getFixture
,
);
}
return
require
(
absolutePath
);
return
fs
.
readFileSync
(
absolutePath
,
'
utf8
'
);
}
export
const
getJSONFixture
=
relativePath
=>
JSON
.
parse
(
getFixture
(
relativePath
));
export
const
resetHTMLFixture
=
()
=>
{
document
.
body
.
textContent
=
''
;
};
export
const
setHTMLFixture
=
(
htmlContent
,
resetHook
=
afterEach
)
=>
{
document
.
body
.
outerHTML
=
htmlContent
;
resetHook
(
resetHTMLFixture
);
};
export
const
loadHTMLFixture
=
(
relativePath
,
resetHook
=
afterEach
)
=>
{
const
fileContent
=
getFixture
(
relativePath
);
setHTMLFixture
(
fileContent
,
resetHook
);
};
spec/
javascripts
/pages/admin/abuse_reports/abuse_reports_spec.js
→
spec/
frontend
/pages/admin/abuse_reports/abuse_reports_spec.js
View file @
735af14b
...
...
@@ -16,9 +16,9 @@ describe('Abuse Reports', () => {
preloadFixtures
(
FIXTURE
);
beforeEach
(
function
()
{
beforeEach
(
()
=>
{
loadFixtures
(
FIXTURE
);
this
.
abuseReports
=
new
AbuseReports
();
new
AbuseReports
();
// eslint-disable-line no-new
$messages
=
$
(
'
.abuse-reports .message
'
);
});
...
...
spec/frontend/test_setup.js
View file @
735af14b
...
...
@@ -2,6 +2,7 @@ import Vue from 'vue';
import
Translate
from
'
~/vue_shared/translate
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
initializeTestTimeout
}
from
'
./helpers/timeout
'
;
import
{
getJSONFixture
,
loadHTMLFixture
,
setHTMLFixture
}
from
'
./helpers/fixtures
'
;
// wait for pending setTimeout()s
afterEach
(()
=>
{
...
...
@@ -26,3 +27,20 @@ Vue.config.devtools = false;
Vue
.
config
.
productionTip
=
false
;
Vue
.
use
(
Translate
);
// workaround for JSDOM not supporting innerText
// see https://github.com/jsdom/jsdom/issues/1245
Object
.
defineProperty
(
global
.
Element
.
prototype
,
'
innerText
'
,
{
get
()
{
return
this
.
textContent
;
},
configurable
:
true
,
// make it so that it doesn't blow chunks on re-running tests with things like --watch
});
// convenience wrapper for migration from Karma
Object
.
assign
(
global
,
{
loadFixtures
:
loadHTMLFixture
,
loadJSONFixtures
:
getJSONFixture
,
preloadFixtures
()
{},
setFixtures
:
setHTMLFixture
,
});
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