From 157ef0a3101d29c9cc5366a2b8bb70b758069675 Mon Sep 17 00:00:00 2001 From: Shane McCarron Date: Wed, 20 Jul 2016 16:06:27 -0500 Subject: [PATCH] Add test count (#75) --- runner/index.html | 6 ++++++ runner/runner.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/runner/index.html b/runner/index.html index 7706da66fc48f1..31b1ce73243ec2 100644 --- a/runner/index.html +++ b/runner/index.html @@ -74,6 +74,12 @@ +
+ +
+
+
+
diff --git a/runner/runner.js b/runner/runner.js index d7c177279ec45b..4319c234eddddc 100644 --- a/runner/runner.js +++ b/runner/runner.js @@ -461,22 +461,35 @@ ManualUI.prototype = { function TestControl(elem, runner) { this.elem = elem; this.path_input = this.elem.querySelector(".path"); + this.path_input.addEventListener("change", function() { + this.set_counts(); + }.bind(this), false); this.use_regex_input = this.elem.querySelector("#use_regex"); + this.use_regex_input.addEventListener("change", function() { + this.set_counts(); + }.bind(this), false); this.pause_button = this.elem.querySelector("button.togglePause"); this.start_button = this.elem.querySelector("button.toggleStart"); this.type_checkboxes = Array.prototype.slice.call( this.elem.querySelectorAll("input[type=checkbox].test-type")); this.type_checkboxes.forEach(function(elem) { + elem.addEventListener("change", function() { + this.set_counts(); + }.bind(this), + false); elem.addEventListener("click", function() { this.start_button.disabled = this.get_test_types().length < 1; }.bind(this), false); }.bind(this)); + this.timeout_input = this.elem.querySelector(".timeout_multiplier"); this.render_checkbox = this.elem.querySelector(".render"); + this.testcount_area = this.elem.querySelector("#testcount"); this.runner = runner; this.runner.done_callbacks.push(this.on_done.bind(this)); this.set_start(); + this.set_counts(); } TestControl.prototype = { @@ -530,6 +543,21 @@ TestControl.prototype = { }, + set_counts: function() { + if (this.runner.manifest_loading) { + setTimeout(function() { + this.set_counts(); + }.bind(this), 1000); + return; + } + var path = this.get_path(); + var test_types = this.get_test_types(); + var use_regex = this.get_use_regex(); + var iterator = new ManifestIterator(this.runner.manifest, path, test_types, use_regex); + var count = iterator.count(); + this.testcount_area.textContent = count; + }, + get_path: function() { return this.path_input.value; }, @@ -622,6 +650,7 @@ function Runner(manifest_path) { this.results = new Results(this); this.start_after_manifest_load = false; + this.manifest_loading = true; this.manifest.load(this.manifest_loaded.bind(this)); } @@ -637,6 +666,7 @@ Runner.prototype = { }, manifest_loaded: function() { + this.manifest_loading = false; if (this.start_after_manifest_load) { this.do_start(); }