Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MUR Drupal
d3-library
Commits
0f2b61ae
Commit
0f2b61ae
authored
Mar 14, 2013
by
Mike Bostock
Browse files
Refactor svg tests using smash.
parent
e65d455a
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/svg/area-radial.js
View file @
0f2b61ae
import
"
svg
"
;
import
"
area
"
;
import
"
svg
"
;
import
"
line-radial
"
;
d3
.
svg
.
area
.
radial
=
function
()
{
var
area
=
d3_svg_area
(
d3_svg_lineRadial
);
...
...
src/svg/symbol.js
View file @
0f2b61ae
import
"
../arrays/map
"
;
import
"
../core/functor
"
;
import
"
../math/trigonometry
"
;
import
"
svg
"
;
d3
.
svg
.
symbol
=
function
()
{
var
type
=
d3_svg_symbolType
,
...
...
test/svg/arc-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
);
var
suite
=
vows
.
describe
(
"
d3.svg.arc
"
);
suite
.
addBatch
({
"
arc
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
arc
;
},
topic
:
load
(
"
svg/arc
"
).
expression
(
"
d3.svg.arc
"
),
"
innerRadius defaults to a function accessor
"
:
function
(
arc
)
{
var
a
=
arc
().
outerRadius
(
100
).
startAngle
(
0
).
endAngle
(
Math
.
PI
);
...
...
test/svg/area-radial-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
d3
=
require
(
"
../../
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
);
var
suite
=
vows
.
describe
(
"
d3.svg.area.radial
"
);
suite
.
addBatch
({
"
area.radial
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
area
.
radial
;
},
topic
:
load
(
"
svg/area-radial
"
).
expression
(
"
d3.svg.area.radial
"
),
"
radius is an alias for setting innerRadius and outerRadius
"
:
function
(
area
)
{
var
a
=
area
().
radius
(
f
);
...
...
@@ -182,18 +180,18 @@ suite.addBatch({
function
testInterpolation
(
interpolate
)
{
var
data
=
[[
10
,
0
],
[
20
,
1
],
[
20
,
2
],
[
10
,
3
]];
var
radial
=
d3
.
svg
.
area
.
radial
()
.
innerRadius
(
function
(
d
)
{
return
d
[
0
];
})
.
outerRadius
(
function
(
d
)
{
return
d
[
0
]
*
2
;
})
.
angle
(
function
(
d
)
{
return
d
[
1
];
});
var
cartesian
=
d3
.
svg
.
area
()
.
x0
(
function
(
d
)
{
return
d
[
0
]
*
Math
.
cos
(
d
[
1
]
-
Math
.
PI
/
2
);
})
.
x1
(
function
(
d
)
{
return
2
*
d
[
0
]
*
Math
.
cos
(
d
[
1
]
-
Math
.
PI
/
2
);
})
.
y0
(
function
(
d
)
{
return
d
[
0
]
*
Math
.
sin
(
d
[
1
]
-
Math
.
PI
/
2
);
})
.
y1
(
function
(
d
)
{
return
2
*
d
[
0
]
*
Math
.
sin
(
d
[
1
]
-
Math
.
PI
/
2
);
});
return
function
()
{
return
function
(
area
)
{
var
radial
=
area
()
.
innerRadius
(
function
(
d
)
{
return
d
[
0
];
})
.
outerRadius
(
function
(
d
)
{
return
d
[
0
]
*
2
;
})
.
angle
(
function
(
d
)
{
return
d
[
1
];
});
assert
.
pathEqual
(
radial
.
interpolate
(
interpolate
)(
data
),
cartesian
.
interpolate
(
interpolate
)(
data
));
};
}
...
...
test/svg/area-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
d3
=
require
(
"
../../
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
);
var
suite
=
vows
.
describe
(
"
d3.svg.area
"
);
suite
.
addBatch
({
"
area
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
area
;
},
topic
:
load
(
"
svg/area
"
).
expression
(
"
d3.svg.area
"
),
"
x is an alias for setting x0 and x1
"
:
function
(
area
)
{
var
a
=
area
().
x
(
f
);
...
...
test/svg/axis-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
assert
=
require
(
"
../env-assert
"
);
d3
=
require
(
"
../../
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
),
document
=
d3
.
selection
().
node
().
_ownerDocument
,
window
=
document
.
defaultView
;
var
suite
=
vows
.
describe
(
"
d3.svg.axis
"
);
suite
.
addBatch
({
"
axis
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
axis
;
}
,
topic
:
load
(
"
svg/axis
"
)
.
expression
(
"
d3.svg.axis
"
)
.
sandbox
({
document
:
document
,
window
:
window
})
,
"
scale
"
:
{
"
defaults to a linear scale
"
:
function
(
axis
)
{
...
...
test/svg/brush-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
assert
=
require
(
"
../env-assert
"
);
d3
=
require
(
"
../../
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
),
jsdom
=
require
(
"
jsdom
"
).
jsdom
,
document
=
jsdom
(
"
<html><head></head><body></body></html>
"
),
window
=
document
.
createWindow
();
var
suite
=
vows
.
describe
(
"
d3.svg.brush
"
);
suite
.
addBatch
({
"
brush
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
brush
;
}
,
topic
:
load
(
"
svg/brush
"
)
.
expression
(
"
d3.svg.brush
"
)
.
sandbox
({
document
:
document
,
window
:
window
})
,
"
x
"
:
{
"
defaults to null
"
:
function
(
brush
)
{
...
...
test/svg/line-radial-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
d3
=
require
(
"
../../
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
);
var
suite
=
vows
.
describe
(
"
d3.svg.line.radial
"
);
suite
.
addBatch
({
"
line.radial
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
line
.
radial
;
},
topic
:
load
(
"
svg/line-radial
"
).
expression
(
"
d3.svg.line.radial
"
),
"
radius defaults to a function accessor
"
:
function
(
line
)
{
var
l
=
line
();
...
...
@@ -110,14 +108,12 @@ suite.addBatch({
function
testInterpolation
(
interpolate
)
{
var
data
=
[[
10
,
0
],
[
20
,
1
],
[
20
,
2
],
[
10
,
3
]];
var
radial
=
d3
.
svg
.
line
.
radial
();
var
cartesian
=
d3
.
svg
.
line
()
.
x
(
function
(
d
)
{
return
d
[
0
]
*
Math
.
cos
(
d
[
1
]
-
Math
.
PI
/
2
);
})
.
y
(
function
(
d
)
{
return
d
[
0
]
*
Math
.
sin
(
d
[
1
]
-
Math
.
PI
/
2
);
});
return
function
()
{
assert
.
pathEqual
(
radial
.
interpolate
(
interpolate
)(
data
),
cartesian
.
interpolate
(
interpolate
)(
data
));
return
function
(
radial
)
{
assert
.
pathEqual
(
radial
()
.
interpolate
(
interpolate
)(
data
),
cartesian
.
interpolate
(
interpolate
)(
data
));
};
}
...
...
test/svg/line-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
);
var
suite
=
vows
.
describe
(
"
d3.svg.line
"
);
suite
.
addBatch
({
"
line
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
line
;
},
topic
:
load
(
"
svg/line
"
).
expression
(
"
d3.svg.line
"
),
"
x defaults to a function accessor
"
:
function
(
line
)
{
var
l
=
line
();
...
...
test/svg/symbol-test.js
View file @
0f2b61ae
require
(
"
../env
"
);
var
vows
=
require
(
"
vows
"
),
load
=
require
(
"
../load
"
),
assert
=
require
(
"
../env-assert
"
);
var
suite
=
vows
.
describe
(
"
d3.svg.symbol
"
);
suite
.
addBatch
({
"
symbol
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
symbol
;
},
topic
:
load
(
"
svg/symbol
"
).
expression
(
"
d3.svg.symbol
"
),
"
default symbol is a fixed-size circle
"
:
function
(
symbol
)
{
var
a
=
symbol
();
assert
.
pathEqual
(
a
(),
"
M0,4.51351666838205A4.51351666838205,4.51351666838205 0 1,1 0,-4.51351666838205A4.51351666838205,4.51351666838205 0 1,1 0,4.51351666838205Z
"
);
...
...
@@ -69,9 +66,7 @@ suite.addBatch({
}
},
"
symbolTypes
"
:
{
topic
:
function
()
{
return
d3
.
svg
.
symbolTypes
;
},
topic
:
load
(
"
svg/symbol
"
).
expression
(
"
d3.svg.symbolTypes
"
),
"
contains circle
"
:
function
(
types
)
{
assert
.
isTrue
(
types
.
indexOf
(
"
circle
"
)
!=
-
1
);
},
...
...
Write
Preview
Supports
Markdown
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