diff options
author | Jared Deckard <jared.deckard@gmail.com> | 2016-09-20 10:50:32 -0500 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2016-11-04 15:07:51 +0000 |
commit | dd45c5e11eb2b315d89779abf6103e2531e1cc08 (patch) | |
tree | 5906db681b1872a25a8e4680bba5e558b43264a9 /app/assets/javascripts/build.js | |
parent | ac7efb29164e0f30e88be713c07672df3f54e3e6 (diff) | |
download | gitlab-ce-dd45c5e11eb2b315d89779abf6103e2531e1cc08.tar.gz |
Add javascript unit tests for Build
Move comments to the correct location
Remove array extension usage
Move build options to fixture to match view
Diffstat (limited to 'app/assets/javascripts/build.js')
-rw-r--r-- | app/assets/javascripts/build.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index 54fed3dd573..3d284e5846f 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -37,6 +37,7 @@ this.initScrollButtonAffix(); } if (this.buildStatus === "running" || this.buildStatus === "pending") { + // Bind autoscroll button to follow build output $('#autoscroll-button').on('click', function() { var state; state = $(this).data("state"); @@ -47,20 +48,15 @@ $(this).data("state", "enabled"); return $(this).text("Disable autoscroll"); } - // - // Bind autoscroll button to follow build output - // }); Build.interval = setInterval((function(_this) { + // Check for new build output if user still watching build page + // Only valid for runnig build when output changes during time return function() { - if (window.location.href.split("#").first() === _this.pageUrl) { + if (_this.location() === _this.pageUrl) { return _this.getBuildTrace(); } }; - // - // Check for new build output if user still watching build page - // Only valid for runnig build when output changes during time - // })(this), 4000); } } @@ -79,6 +75,10 @@ this.$document.off('scroll.translateSidebar').on('scroll.translateSidebar', this.translateSidebar.bind(this)); }; + Build.prototype.location = function() { + return window.location.href.split("#")[0]; + }; + Build.prototype.getInitialBuildTrace = function() { var removeRefreshStatuses = ['success', 'failed', 'canceled', 'skipped'] |