Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bioviz-js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Remi PLANEL
bioviz-js
Commits
bf6b75cc
Commit
bf6b75cc
authored
Jun 04, 2019
by
Remi PLANEL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test click event
parent
b4e885d6
Pipeline
#12161
passed with stage
in 1 minute and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
tests/gene.test.ts
tests/gene.test.ts
+25
-6
No files found.
tests/gene.test.ts
View file @
bf6b75cc
...
...
@@ -13,6 +13,9 @@ describe("Test gene componennt", () => {
begin
:
10
,
end
:
50
,
gene
:
"
insA
"
,
eventHandler
:
{
click
:
(
geneLocation
)
=>
console
.
log
(
geneLocation
)
}
},
{
name
:
"
gene 2
"
,
...
...
@@ -21,21 +24,37 @@ describe("Test gene componennt", () => {
end
:
100
,
gene
:
"
yaaY
"
,
}];
let
window
=
[
0
,
120
];
const
geneComponent
=
Gene
();
const
xScale
=
scaleLinear
()
.
domain
(
[
0
,
120
]
)
.
domain
(
window
)
.
range
([
0
,
1200
]);
const
container
=
select
(
"
svg
"
)
.
select
<
SVGGElement
>
(
"
g
"
);
test
(
"
test html generated by gene component
"
,
()
=>
{
const
container
=
select
(
"
svg
"
)
.
select
<
SVGGElement
>
(
"
g
"
);
container
.
datum
<
GeneData
[]
>
(
data
)
.
call
(
geneComponent
,
xScale
);
expect
(
container
.
html
()).
toBe
(
result
);
});
test
(
"
Click
"
,
()
=>
{
const
result
=
'
<g class=
\
"gene
\
" transform=
\
"translate(0,60)
\
"><path style=
\
"fill-opacity: 0.85; stroke-width: 1px; stroke-opacity: 0.8;
\
" transform=
\
"translate(0,35) translate(533.3333333333333,30) rotate(180)
\
" d=
\
"M0,0L0,30L523.3333333333333,30L533.3333333333333,15L523.3333333333333,0Z
\
"></path></g><g class=
\
"gene
\
" transform=
\
"translate(666.6666666666667,60)
\
"><path style=
\
"fill-opacity: 0.85; stroke-width: 1px; stroke-opacity: 0.8;
\
" d=
\
"M0,0L0,30L523.3333333333333,30L533.3333333333333,15L523.3333333333333,0Z
\
"></path></g>
'
;
const
path
=
container
.
selectAll
(
"
.gene
"
).
select
<
SVGPathElement
>
(
"
path
"
);
if
(
path
)
{
path
.
dispatch
(
"
click
"
);
window
=
[
10
,
100
]
xScale
.
domain
(
window
);
container
.
datum
<
GeneData
[]
>
(
data
)
.
call
(
geneComponent
,
xScale
);
// path.dispatchEvent(new Event('click'));
expect
(
container
.
html
()).
toBe
(
result
);
})
}
});
});
\ No newline at end of file
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