Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mirador Video
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IIIF
Mirador
Mirador Video
Commits
e69e0185
Commit
e69e0185
authored
Mar 22, 2017
by
Javier de la Rosa
Browse files
Options
Downloads
Patches
Plain Diff
Adding tests to check if annoations related to a search result are shown and working
parent
8039d6ce
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/widgets/searchWithin.test.js
+50
-0
50 additions, 0 deletions
spec/widgets/searchWithin.test.js
with
50 additions
and
0 deletions
spec/widgets/searchWithin.test.js
+
50
−
0
View file @
e69e0185
...
...
@@ -122,5 +122,55 @@ describe('Search tab', function() {
"
bounds
"
:
bounds
});
});
it
(
'
should show annotations when a search result is linked to more than one
'
,
function
()
{
this
.
sandbox
.
find
(
'
#search-within-form input.js-query
'
).
val
(
'
found
'
);
this
.
sandbox
.
find
(
'
#search-within-form
'
).
trigger
(
'
submit
'
);
expect
(
this
.
sandbox
.
find
(
'
.search-annotation
'
).
first
()).
toExist
();
});
it
(
'
should allow clicking on annotations when a search result is linked to more than one
'
,
function
()
{
this
.
sandbox
.
find
(
'
#search-within-form input.js-query
'
).
val
(
'
found
'
);
this
.
sandbox
.
find
(
'
#search-within-form
'
).
trigger
(
'
submit
'
);
var
anno
=
this
.
sandbox
.
find
(
'
.search-annotation
'
).
first
();
expect
(
anno
).
toExist
();
expect
(
anno
.
trigger
.
bind
(
anno
,
'
click
'
)).
not
.
toThrow
();
});
it
(
'
should navigate to a specific bounds and canvas after clicking on an search result linked annotation
'
,
function
()
{
spyOn
(
this
.
eventEmitter
,
'
publish
'
).
and
.
callThrough
();
this
.
sandbox
.
find
(
'
#search-within-form input.js-query
'
).
val
(
'
found
'
);
this
.
sandbox
.
find
(
'
#search-within-form
'
).
trigger
(
'
submit
'
);
var
anno
=
this
.
sandbox
.
find
(
'
.search-annotation
'
).
first
(),
canvasID
=
anno
.
attr
(
'
data-canvasid
'
),
coordinates
=
anno
.
attr
(
'
data-coordinates
'
),
xywh
=
coordinates
&&
coordinates
.
split
(
'
=
'
)[
1
].
split
(
'
,
'
).
map
(
Number
),
bounds
=
xywh
&&
{
x
:
xywh
[
0
],
y
:
xywh
[
1
],
width
:
xywh
[
2
],
height
:
xywh
[
3
]};
anno
.
trigger
(
'
click
'
);
expect
(
this
.
eventEmitter
.
publish
).
toHaveBeenCalledWith
(
'
SET_CURRENT_CANVAS_ID.
'
+
this
.
windowId
,
{
"
canvasID
"
:
canvasID
,
"
bounds
"
:
bounds
});
});
it
(
'
should not change canvas after clicking on a second annotation linked to a search result
'
,
function
()
{
this
.
sandbox
.
find
(
'
#search-within-form input.js-query
'
).
val
(
'
found
'
);
this
.
sandbox
.
find
(
'
#search-within-form
'
).
trigger
(
'
submit
'
);
var
anno1
=
this
.
sandbox
.
find
(
'
.search-annotation
'
).
first
(),
anno2
=
this
.
sandbox
.
find
(
'
.search-annotation:nth-child(2)
'
).
first
(),
canvasID1
=
anno2
.
attr
(
'
data-canvasid
'
),
canvasID2
=
anno2
.
attr
(
'
data-canvasid
'
),
coordinates
=
anno2
.
attr
(
'
data-coordinates
'
),
xywh
=
coordinates
&&
coordinates
.
split
(
'
=
'
)[
1
].
split
(
'
,
'
).
map
(
Number
),
bounds
=
xywh
&&
{
x
:
xywh
[
0
],
y
:
xywh
[
1
],
width
:
xywh
[
2
],
height
:
xywh
[
3
]};
anno1
.
trigger
(
'
click
'
);
spyOn
(
this
.
eventEmitter
,
'
publish
'
).
and
.
callThrough
();
anno2
.
trigger
(
'
click
'
);
expect
(
canvasID1
).
toBe
(
canvasID2
);
expect
(
this
.
eventEmitter
.
publish
).
toHaveBeenCalledWith
(
'
SET_CURRENT_CANVAS_ID.
'
+
this
.
windowId
,
{
"
canvasID
"
:
canvasID2
,
"
bounds
"
:
bounds
});
});
});
});
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