Skip to content

Commit

Permalink
Fix coverage reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mironov committed Aug 2, 2020
1 parent 5e2e74e commit 22e1b91
Show file tree
Hide file tree
Showing 3 changed files with 730 additions and 337 deletions.
67 changes: 32 additions & 35 deletions build/loading_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,41 @@ var LoadingBar = /*#__PURE__*/function (_Component) {

var _super = _createSuper(LoadingBar);

function LoadingBar() {
var _this;
_createClass(LoadingBar, null, [{
key: "shouldStart",
value: function shouldStart(props, state) {
return props.loading > 0 && ['hidden', 'stopping'].indexOf(state.status) >= 0;
}
}, {
key: "shouldStop",
value: function shouldStop(props, state) {
return props.loading === 0 && ['starting', 'running'].indexOf(state.status) >= 0;
}
}, {
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (LoadingBar.shouldStart(nextProps, prevState)) {
return {
status: 'starting'
};
}

_classCallCheck(this, LoadingBar);
if (LoadingBar.shouldStop(nextProps, prevState)) {
return {
status: 'stopping'
};
}

for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
return null;
}
}]);

_this = _super.call.apply(_super, [this].concat(args));
_this.state = _objectSpread({}, initialState);
function LoadingBar(props) {
var _this;

_classCallCheck(this, LoadingBar);

_this = _super.call(this, props);

_this.reset = function () {
_this.terminatingAnimationTimeoutId = null;
Expand Down Expand Up @@ -110,6 +134,7 @@ var LoadingBar = /*#__PURE__*/function (_Component) {
});
};

_this.state = _objectSpread({}, initialState);
return _this;
}

Expand Down Expand Up @@ -185,7 +210,6 @@ var LoadingBar = /*#__PURE__*/function (_Component) {
status = _this$state.status,
percent = _this$state.percent;
var _this$props = this.props,
direction = _this$props.direction,
className = _this$props.className,
customStyle = _this$props.style;
var animationDuration = status === 'stopping' ? TERMINATING_ANIMATION_DURATION : ANIMATION_DURATION;
Expand Down Expand Up @@ -239,33 +263,6 @@ var LoadingBar = /*#__PURE__*/function (_Component) {
}
}));
}
}], [{
key: "shouldStart",
value: function shouldStart(props, state) {
return props.loading > 0 && ['hidden', 'stopping'].indexOf(state.status) >= 0;
}
}, {
key: "shouldStop",
value: function shouldStop(props, state) {
return props.loading === 0 && ['starting', 'running'].indexOf(state.status) >= 0;
}
}, {
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (LoadingBar.shouldStart(nextProps, prevState)) {
return {
status: 'starting'
};
}

if (LoadingBar.shouldStop(nextProps, prevState)) {
return {
status: 'stopping'
};
}

return null;
}
}]);

return LoadingBar;
Expand Down
Loading

0 comments on commit 22e1b91

Please sign in to comment.