Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
6f776365
Verified
Commit
6f776365
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
TST: update tests for new implementation of linkify
parent
94f2132f
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!59
REL: release 0.4.1
,
!55
F linkify edit mode
Pipeline
#16866
passed
3 years ago
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/js/modules/ext_cosmetics.js.js
+25
-18
25 additions, 18 deletions
test/core/js/modules/ext_cosmetics.js.js
with
25 additions
and
18 deletions
test/core/js/modules/ext_cosmetics.js.js
+
25
−
18
View file @
6f776365
...
@@ -46,13 +46,16 @@ QUnit.test("linkify - https", function (assert) {
...
@@ -46,13 +46,16 @@ QUnit.test("linkify - https", function (assert) {
[
"
this is other text https://link
"
,
1
],
[
"
this is other text https://link
"
,
1
],
[
"
this is other text https://link and here comes another link https://link and more text
"
,
2
],
[
"
this is other text https://link and here comes another link https://link and more text
"
,
2
],
];
];
for
(
let
test_case
of
test_cases
)
{
for
(
let
test_case
of
test_cases
)
{
var
text_value
=
$
(
`<div class="caosdb-f-property-text-value">
${
test_case
[
0
]}
</div>`
);
const
container
=
$
(
'
<div></div>
'
);
$
(
document
.
body
).
append
(
text_value
);
$
(
document
.
body
).
append
(
container
);
assert
.
equal
(
$
(
text_value
).
find
(
"
a[href='https://link']
"
).
length
,
0
,
"
no link present
"
);
const
text_value
=
$
(
`<div class="caosdb-f-property-text-value">
${
test_case
[
0
]}
</div>`
);
container
.
append
(
text_value
);
assert
.
equal
(
$
(
container
).
find
(
"
a[href='https://link']
"
).
length
,
0
,
"
no link present
"
);
cosmetics
.
linkify
();
cosmetics
.
linkify
();
assert
.
equal
(
$
(
text_value
).
find
(
"
a[href='https://link']
"
).
length
,
test_case
[
1
],
"
link is present
"
);
assert
.
equal
(
$
(
container
).
find
(
"
a[href='https://link']
"
).
length
,
test_case
[
1
],
"
link is present
"
);
text_value
.
remove
();
container
.
remove
();
}
}
});
});
...
@@ -66,22 +69,26 @@ QUnit.test("linkify - http", function (assert) {
...
@@ -66,22 +69,26 @@ QUnit.test("linkify - http", function (assert) {
[
"
this is other text http://link and here comes another link http://link and more text
"
,
2
],
[
"
this is other text http://link and here comes another link http://link and more text
"
,
2
],
];
];
for
(
let
test_case
of
test_cases
)
{
for
(
let
test_case
of
test_cases
)
{
var
text_value
=
$
(
`<div class="caosdb-f-property-text-value">
${
test_case
[
0
]}
</div>`
);
const
container
=
$
(
'
<div></div>
'
);
$
(
document
.
body
).
append
(
text_value
);
$
(
document
.
body
).
append
(
container
);
assert
.
equal
(
$
(
text_value
).
find
(
"
a[href='http://link']
"
).
length
,
0
,
"
no link present
"
);
const
text_value
=
$
(
`<div class="caosdb-f-property-text-value">
${
test_case
[
0
]}
</div>`
);
$
(
container
).
append
(
text_value
);
assert
.
equal
(
$
(
container
).
find
(
"
a[href='http://link']
"
).
length
,
0
,
"
no link present
"
);
cosmetics
.
linkify
();
cosmetics
.
linkify
();
assert
.
equal
(
$
(
text_value
).
find
(
"
a[href='http://link']
"
).
length
,
test_case
[
1
],
"
link is present
"
);
assert
.
equal
(
$
(
container
).
find
(
"
a[href='http://link']
"
).
length
,
test_case
[
1
],
"
link is present
"
);
text_value
.
remove
();
container
.
remove
();
}
}
});
});
QUnit
.
test
(
"
linkify cut-off (40)
"
,
function
(
assert
)
{
QUnit
.
test
(
"
linkify cut-off (40)
"
,
function
(
assert
)
{
var
test_case
=
"
here is some text https://this.is.a.link/with/more/than/40/characters/ this is more text
"
;
const
container
=
$
(
'
<div></div>
'
);
var
text_value
=
$
(
`<div class="caosdb-f-property-text-value">
${
test_case
}
</div>`
);
$
(
document
.
body
).
append
(
container
);
$
(
document
.
body
).
append
(
text_value
);
const
test_case
=
"
here is some text https://this.is.a.link/with/more/than/40/characters/ this is more text
"
;
assert
.
equal
(
$
(
text_value
).
find
(
"
a
"
).
length
,
0
,
"
no link present
"
);
const
text_value
=
$
(
`<div class="caosdb-f-property-text-value">
${
test_case
}
</div>`
);
$
(
container
).
append
(
text_value
);
assert
.
equal
(
$
(
container
).
find
(
"
a
"
).
length
,
0
,
"
no link present
"
);
cosmetics
.
linkify
();
cosmetics
.
linkify
();
assert
.
equal
(
$
(
text_value
).
find
(
"
a
"
).
length
,
1
,
"
link is present
"
);
assert
.
equal
(
$
(
container
).
find
(
"
a
"
).
length
,
1
,
"
link is present
"
);
assert
.
equal
(
$
(
text_value
).
find
(
"
a
"
).
text
(),
"
https://this.is.a.link/with/more/th[...]
"
,
"
link text has been cut off
"
);
assert
.
equal
(
$
(
container
).
find
(
"
a
"
).
text
(),
"
https://this.is.a.link/with/more/th[...]
"
,
"
link text has been cut off
"
);
text_value
.
remove
();
container
.
remove
();
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment