Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
9a80b6ac
Commit
9a80b6ac
authored
Apr 11, 2019
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert markdown-test mocking to babel-plugin-mockable-imports
parent
a82d1941
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
38 deletions
+30
-38
markdown-test.js
src/sidebar/components/test/markdown-test.js
+30
-38
No files found.
src/sidebar/components/test/markdown-test.js
View file @
9a80b6ac
'use strict'
;
'use strict'
;
const
angular
=
require
(
'angular'
);
const
angular
=
require
(
'angular'
);
const
proxyquire
=
require
(
'proxyquire'
);
const
util
=
require
(
'../../directive/test/util'
);
const
util
=
require
(
'../../directive/test/util'
);
const
noCallThru
=
require
(
'../../../shared/test/util'
).
noCallThru
;
const
markdown
=
require
(
'../markdown'
)
;
describe
(
'markdown'
,
function
()
{
describe
(
'markdown'
,
function
()
{
function
isHidden
(
element
)
{
function
isHidden
(
element
)
{
...
@@ -40,46 +39,39 @@ describe('markdown', function() {
...
@@ -40,46 +39,39 @@ describe('markdown', function() {
}
}
before
(
function
()
{
before
(
function
()
{
angular
.
module
(
'app'
).
component
(
angular
.
module
(
'app'
,
[]).
component
(
'markdown'
,
markdown
);
'markdown'
,
proxyquire
(
'../markdown'
,
noCallThru
({
angular
:
angular
,
katex
:
{
renderToString
:
function
(
input
)
{
return
'math:'
+
input
.
replace
(
/$$/g
,
''
);
},
},
'lodash.debounce'
:
function
(
fn
)
{
// Make input change debouncing synchronous in tests
return
function
()
{
fn
();
};
},
'../render-markdown'
:
noCallThru
(
function
(
markdown
)
{
return
'rendered:'
+
markdown
;
}),
'../markdown-commands'
:
{
convertSelectionToLink
:
mockFormattingCommand
,
toggleBlockStyle
:
mockFormattingCommand
,
toggleSpanStyle
:
mockFormattingCommand
,
LinkType
:
require
(
'../../markdown-commands'
).
LinkType
,
},
'../media-embedder'
:
noCallThru
({
replaceLinksWithEmbeds
:
function
(
element
)
{
// Tag the element as having been processed
element
.
dataset
.
replacedLinksWithEmbeds
=
'yes'
;
},
}),
})
)
);
});
});
beforeEach
(
function
()
{
beforeEach
(
function
()
{
angular
.
mock
.
module
(
'app'
);
angular
.
mock
.
module
(
'app'
);
markdown
.
$imports
.
$mock
({
'lodash.debounce'
:
function
(
fn
)
{
// Make input change debouncing synchronous in tests
return
function
()
{
fn
();
};
},
'../render-markdown'
:
markdown
=>
{
return
'rendered:'
+
markdown
;
},
'../markdown-commands'
:
{
convertSelectionToLink
:
mockFormattingCommand
,
toggleBlockStyle
:
mockFormattingCommand
,
toggleSpanStyle
:
mockFormattingCommand
,
LinkType
:
require
(
'../../markdown-commands'
).
LinkType
,
},
'../media-embedder'
:
{
replaceLinksWithEmbeds
:
function
(
element
)
{
// Tag the element as having been processed
element
.
dataset
.
replacedLinksWithEmbeds
=
'yes'
;
},
},
});
});
afterEach
(()
=>
{
markdown
.
$imports
.
$restore
();
});
});
describe
(
'read only state'
,
function
()
{
describe
(
'read only state'
,
function
()
{
...
...
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