Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
waterdataui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository 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
Water Mission Area
Internet of Water
waterdataui
Commits
f5625f82
Commit
f5625f82
authored
7 years ago
by
Bucknell, Mary S.
Browse files
Options
Downloads
Patches
Plain Diff
Added accessibility tests to hydrograph tests.
parent
b7bde4a0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assets/src/scripts/hydrograph/index.js
+1
-1
1 addition, 1 deletion
assets/src/scripts/hydrograph/index.js
assets/src/scripts/hydrograph/index.spec.js
+33
-3
33 additions, 3 deletions
assets/src/scripts/hydrograph/index.spec.js
with
34 additions
and
4 deletions
assets/src/scripts/hydrograph/index.js
+
1
−
1
View file @
f5625f82
...
...
@@ -34,7 +34,7 @@ class Hydrograph {
* @param {String} desc for svg's desc attribute
* @param {Node} element Dom node to insert
*/
constructor
({
data
=
[],
yLabel
=
'
Data
'
,
title
=
'
Time series graph
'
,
desc
=
'
Time series graph
'
,
element
=
document
.
body
}
=
{})
{
constructor
({
data
=
[],
yLabel
=
'
Data
'
,
title
=
'
'
,
desc
=
'
'
,
element
}
=
{})
{
this
.
_data
=
data
;
this
.
_yLabel
=
yLabel
;
this
.
_title
=
title
;
...
...
This diff is collapsed.
Click to expand it.
assets/src/scripts/hydrograph/index.spec.js
+
33
−
3
View file @
f5625f82
...
...
@@ -5,6 +5,7 @@ const Hydrograph = require('../hydrograph/index');
describe
(
'
Hydrograph charting module
'
,
()
=>
{
let
graphNode
;
beforeEach
(()
=>
{
select
(
'
body
'
)
.
append
(
'
div
'
)
...
...
@@ -17,12 +18,12 @@ describe('Hydrograph charting module', () => {
});
it
(
'
empty graph displays warning
'
,
()
=>
{
let
graph
=
new
Hydrograph
({
element
:
graphNode
});
new
Hydrograph
({
element
:
graphNode
});
expect
(
graphNode
.
innerHTML
).
toContain
(
'
No data is available
'
);
});
it
(
'
single data point renders
'
,
()
=>
{
let
graph
=
new
Hydrograph
({
new
Hydrograph
({
element
:
graphNode
,
data
:
[{
time
:
new
Date
(),
...
...
@@ -33,6 +34,35 @@ describe('Hydrograph charting module', () => {
expect
(
graphNode
.
innerHTML
).
toContain
(
'
hydrograph-container
'
);
});
describe
(
'
SVG has been made accessibile
'
,
()
=>
{
let
svg
;
beforeEach
(()
=>
{
new
Hydrograph
({
element
:
graphNode
,
title
:
'
My Title
'
,
desc
:
'
My Description
'
,
data
:
[{
time
:
new
Date
(),
value
:
10
,
label
:
'
Label
'
}]
});
svg
=
select
(
'
svg
'
);
});
it
(
'
title and desc attributes are present
'
,
function
()
{
expect
(
svg
.
attr
(
'
title
'
),
'
My Title
'
);
expect
(
svg
.
attr
(
'
desc
'
),
'
My Description
'
);
let
labelledBy
=
svg
.
attr
(
'
aria-labelledby
'
);
expect
(
labelledBy
).
toContain
(
'
title
'
);
expect
(
labelledBy
).
toContain
(
'
desc
'
);
});
it
(
'
svg should be focusable
'
,
function
()
{
expect
(
svg
.
attr
(
'
tabindex
'
)).
toBe
(
'
0
'
);
});
});
describe
(
'
Renders real data from site #05370000
'
,
()
=>
{
/* eslint no-use-before-define: "ignore" */
beforeEach
(()
=>
{
...
...
@@ -149,4 +179,4 @@ const MOCK_DATA = `[
"time": "2018-01-03T18:15:00.000Z",
"value": 24
}
]`
]`
;
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