Skip to content

Commit

Permalink
Fix: $waterfall service, 修复瀑布流判定输入为undefined抛出异常。
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-xiao-jian committed May 17, 2016
1 parent 68b9aca commit e7754cd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/echarts-ng.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
* @description - adapt tooltip when active waterfall transfer
*/
function shouldAdaptWaterfall(config) {
if (!angular.isArray(config.series) || config.series.length !== 1) return false;
if (!angular.isObject(config) || !angular.isArray(config.series) || config.series.length !== 1) return false;

var target = config.series[0];

Expand Down
2 changes: 1 addition & 1 deletion dist/echarts-ng.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/src/echarts-ng-waterfall.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @description - adapt tooltip when active waterfall transfer
*/
function shouldAdaptWaterfall(config) {
if (!angular.isArray(config.series) || config.series.length !== 1) return false;
if (!angular.isObject(config) || !angular.isArray(config.series) || config.series.length !== 1) return false;

var target = config.series[0];

Expand Down
2 changes: 1 addition & 1 deletion src/echarts-ng-waterfall.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @description - adapt tooltip when active waterfall transfer
*/
function shouldAdaptWaterfall(config) {
if (!angular.isArray(config.series) || config.series.length !== 1) return false;
if (!angular.isObject(config) || !angular.isArray(config.series) || config.series.length !== 1) return false;

var target = config.series[0];

Expand Down
1 change: 1 addition & 0 deletions test/service/waterfall.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('echarts-ng waterfall service', function () {
}));

it('should provide assay result whether waterfall adapt should active', function () {
expect($waterfall.shouldAdaptWaterfall()).toBeFalsy();
expect($waterfall.shouldAdaptWaterfall({})).toBeFalsy();
expect($waterfall.shouldAdaptWaterfall({series: [1, 2]})).toBeFalsy();
expect($waterfall.shouldAdaptWaterfall({series: [{data: 'hello world!'}]})).toBeFalsy();
Expand Down

0 comments on commit e7754cd

Please sign in to comment.