File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
test/jasmine/bundle_tests Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ var Plotly = require ( '@lib/core' ) ;
2+ var ohlc = require ( '@lib/ohlc' ) ;
3+ var candlestick = require ( '@lib/candlestick' ) ;
4+
5+ var d3 = require ( 'd3' ) ;
6+ var createGraphDiv = require ( '../assets/create_graph_div' ) ;
7+ var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
8+
9+ describe ( 'Bundle with finance trace type' , function ( ) {
10+ 'use strict' ;
11+
12+ Plotly . register ( [ ohlc , candlestick ] ) ;
13+
14+ var mock = require ( '@mocks/finance_style.json' ) ;
15+
16+ it ( 'should register the correct trace modules for the generated traces' , function ( ) {
17+ var transformModules = Object . keys ( Plotly . Plots . transformsRegistry ) ;
18+
19+ expect ( transformModules ) . toEqual ( [ 'ohlc' , 'candlestick' ] ) ;
20+ } ) ;
21+
22+ it ( 'should register the correct trace modules for the generated traces' , function ( ) {
23+ var traceModules = Object . keys ( Plotly . Plots . modules ) ;
24+
25+ expect ( traceModules ) . toEqual ( [ 'scatter' , 'box' , 'ohlc' , 'candlestick' ] ) ;
26+ } ) ;
27+
28+ it ( 'should graph ohlc and candlestick traces' , function ( done ) {
29+
30+ Plotly . plot ( createGraphDiv ( ) , mock . data , mock . layout ) . then ( function ( ) {
31+ var gSubplot = d3 . select ( 'g.cartesianlayer' ) ;
32+
33+ expect ( gSubplot . selectAll ( 'g.trace.scatter' ) . size ( ) ) . toEqual ( 2 ) ;
34+ expect ( gSubplot . selectAll ( 'g.trace.boxes' ) . size ( ) ) . toEqual ( 2 ) ;
35+
36+ destroyGraphDiv ( ) ;
37+ done ( ) ;
38+ } ) ;
39+
40+ } ) ;
41+ } ) ;
You can’t perform that action at this time.
0 commit comments