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
39323bc3
Commit
39323bc3
authored
6 months ago
by
VISHESH0932
Browse files
Options
Downloads
Patches
Plain Diff
modified: test/core/js/modules/ext_cosmetics.js.js
parent
8f547c85
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!143
EXTERN: MR 116 Changes
Pipeline
#57142
failed
6 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/js/modules/ext_cosmetics.js.js
+18
-9
18 additions, 9 deletions
test/core/js/modules/ext_cosmetics.js.js
with
18 additions
and
9 deletions
test/core/js/modules/ext_cosmetics.js.js
+
18
−
9
View file @
39323bc3
...
...
@@ -120,22 +120,31 @@ QUnit.test("linkify cut-off (40)", function(assert) {
});
QUnit
.
test
(
"
linkify - double values in URLs
"
,
function
(
assert
)
{
QUnit
.
test
(
"
prettify_double_values - double values in text and URLs
"
,
function
(
assert
)
{
var
test_cases
=
[
[
"
https://example.com/value=
1.2345
"
,
1
],
[
"
This is a URL with a double value: https://example.com/value=
1.2345
"
,
1
],
[
"
https://example.com?param=123
.
456
&other=
789
.
1011
"
,
1
],
[
"
Multiple links with doubles: https://example.com?param=1.1 and https://example2.com?param=
2.2
"
,
2
],
[
"
https://example.com/value=
4.9999999999e+22
"
,
"
5.0e+22
"
],
[
"
This is a URL with a double value: https://example.com/value=
4.9999999999e+22
"
,
"
5.0e+22
"
],
[
"
https://example.com?param=123456
7.99999&other=0.000000
7891011
"
,
"
1.234568e+6
"
],
[
"
Multiple links with doubles: https://example.com?param=1
23456789
.1 and https://example2.com?param=
0.00000002
"
,
"
1.234568e+8 and 2.0e-8
"
],
];
for
(
let
test_case
of
test_cases
)
{
const
container
=
$
(
'
<div></div>
'
);
$
(
document
.
body
).
append
(
container
);
const
text_value
=
$
(
`<div class="caosdb-f-property-
text
-value">
${
test_case
[
0
]}
</div>`
);
const
text_value
=
$
(
`<div class="caosdb-f-property-
double
-value">
${
test_case
[
0
]}
</div>`
);
container
.
append
(
text_value
);
assert
.
equal
(
$
(
container
).
find
(
"
a
"
).
length
,
0
,
"
no link present
"
);
cosmetics
.
linkify
();
assert
.
equal
(
$
(
container
).
find
(
"
a
"
).
length
,
test_case
[
1
],
"
link is present
"
);
// Ensure no prettification has occurred yet
assert
.
equal
(
$
(
container
).
text
().
indexOf
(
test_case
[
1
]),
-
1
,
"
no prettified double value present
"
);
// Apply the prettify_double_values function
prettify_double_values
();
// Check that the prettified value is now displayed
assert
.
notEqual
(
$
(
container
).
text
().
indexOf
(
test_case
[
1
]),
-
1
,
"
prettified double value is present
"
);
// Clean up
container
.
remove
();
}
});
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