Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gy4443
chemotion_eln_server
Commits
ed711b24
Commit
ed711b24
authored
Sep 29, 2017
by
PiTrem
Browse files
js spec for analysis search & replace
parent
9fc5653a
Changes
1
Hide whitespace changes
Inline
Side-by-side
spec/javascripts/utils/ElementUtils.spec.js
0 → 100644
View file @
ed711b24
import
React
from
'
react
'
import
expect
from
'
expect
'
import
{
searchAndReplace
}
from
'
../../../app/assets/javascripts/components/utils/quillFormat
'
;
import
{
sampleAnalysesFormatPattern
}
from
'
../../../app/assets/javascripts/components/utils/ElementUtils
'
describe
(
'
sampleAnalysesFormatPattern
'
,
()
=>
{
describe
(
'
_1hnmr
'
,
()
=>
{
const
_1hnmr
=
sampleAnalysesFormatPattern
[
'
_1hnmr
'
]
it
(
'
replaces "3 H" by "3H"
'
,
()
=>
{
let
content
=
{
ops
:
[{
insert
:
'
Hello 3 Hi, 3 H byebye
'
}]
}
const
expected
=
'
Hello 3Hi, 3H byebye
'
_1hnmr
.
forEach
((
patt
)
=>
{
content
=
searchAndReplace
(
content
,
patt
.
pattern
,
patt
.
replace
);
});
expect
(
content
.
ops
[
0
][
'
insert
'
]).
toEqual
(
expected
)
})
})
})
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