Skip to content

Commit

Permalink
Hide player version choices if not needed in selected testsuite (#10)
Browse files Browse the repository at this point in the history
* Hide player version choices if not needed in selected testsuite

* add missing class in style.css & code cleanup
  • Loading branch information
lukasz-rutkowski-red authored Jul 6, 2022
1 parent f56e479 commit fe8142f
Showing 1 changed file with 61 additions and 36 deletions.
97 changes: 61 additions & 36 deletions patches/0001_js_mse_eme_mvt.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From a28ec7f9a6bd8777e13e64d3043729d984c93a1c Mon Sep 17 00:00:00 2001
From: Maciej Kolanski <maciej.kolanski@consult.red>
Date: Fri, 22 Apr 2022 13:53:29 +0200
From 9e5b57a8cd862b34f3327748e74ef0a85450964c Mon Sep 17 00:00:00 2001
From: Lukasz Rutkowski <lukasz.rutkowski@consult.red>
Date: Tue, 5 Jul 2022 17:08:55 +0200
Subject: [PATCH] MVT changes

* Load MVT tests instead of the upstream tests
Expand All @@ -12,17 +12,19 @@ Subject: [PATCH] MVT changes
* Add engine (player) selectors
* Remove some unsupported links
* Add links to YouTube test suite and Media Coverage
* Hide player version choices if not needed in selected testsuite
---
harness/compactTestView.js | 33 +++++---------
harness/constants.js | 3 +-
harness/main.js | 13 +++++-
harness/test.js | 93 ++++++++++++++++----------------------
harness/testView.js | 32 +++++++------
harness/testView.js | 39 ++++++++++------
harness/timeout.js | 9 ++++
6 files changed, 91 insertions(+), 92 deletions(-)
style.css | 6 ++-
7 files changed, 101 insertions(+), 95 deletions(-)

diff --git a/harness/compactTestView.js b/harness/compactTestView.js
index 77f7b68..9bcad03 100644
index 77f7b68..9bc41a7 100644
--- a/harness/compactTestView.js
+++ b/harness/compactTestView.js
@@ -1,6 +1,7 @@
Expand Down Expand Up @@ -337,7 +339,7 @@ index b781e31..b20d03d 100644
}
return results;
diff --git a/harness/testView.js b/harness/testView.js
index c040757..bf5192a 100644
index c040757..640ba1b 100644
--- a/harness/testView.js
+++ b/harness/testView.js
@@ -1,6 +1,7 @@
Expand All @@ -348,20 +350,7 @@ index c040757..bf5192a 100644
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,10 +28,11 @@ var createAnchor = function(text, id) {
return anchor;
};

-var createOption = function(text, value) {
+var createOption = function(text, value, isSelected = false) {
var option = document.createElement('option');
option.text = text;
option.value = value;
+ isSelected && (option.selected = 'selected');
return option;
};

@@ -44,18 +46,14 @@ function TestView(testSuiteVer) {
@@ -44,18 +45,14 @@ function TestView(testSuiteVer) {
var testSuites = [];
var links = [];

Expand All @@ -383,7 +372,7 @@ index c040757..bf5192a 100644
})
};

@@ -103,7 +101,7 @@ function TestView(testSuiteVer) {
@@ -103,7 +100,7 @@ function TestView(testSuiteVer) {

this.generate = function() {
var heading = '[' + this.testSuiteVer + '] ' +
Expand All @@ -392,7 +381,7 @@ index c040757..bf5192a 100644
try {
document.title = testSuiteDescriptions[harnessConfig.testType].title;
} catch (e) {
@@ -112,6 +110,9 @@ function TestView(testSuiteVer) {
@@ -112,6 +109,9 @@ function TestView(testSuiteVer) {
document.body.appendChild(createElement('span', 'title', null, heading));
document.body.appendChild(createElement('span', 'info', 'h4'));
document.body.appendChild(createElement('span', 'usage', 'h4'));
Expand All @@ -402,28 +391,37 @@ index c040757..bf5192a 100644
document.body.appendChild(createElement('div', 'testview'));

var div = document.getElementById(this.divId);
@@ -150,12 +151,17 @@ function TestView(testSuiteVer) {
@@ -149,14 +149,23 @@ function TestView(testSuiteVer) {
switchDiv.lastChild.exec = switchDiv.lastChild.onclick;
}
for (var i = 0; i < selectors.length; ++i) {
switchDiv.appendChild(document.createTextNode(selectors[i].text));
- switchDiv.appendChild(document.createTextNode(selectors[i].text));
- var select = document.createElement('select');
+ var select = document.createElement('span');
+ select.id = selectors[i].id;
for (var j = 0; j < selectors[i].optionTexts.length; ++j) {
- for (var j = 0; j < selectors[i].optionTexts.length; ++j) {
- select.appendChild(createOption(selectors[i].optionTexts[j],
- selectors[i].values[j]));
+ select.appendChild(createAnchor(selectors[i].optionTexts[j],selectors[i].optionTexts[j]));
+ select.lastChild.setAttribute('data-href', location.origin + "?test_type=" + harnessConfig.testType + "&engine_" + selectors[i].id + "=" + selectors[i].optionTexts[j]);
+ select.lastChild.onclick = window.navigate;
+ if (selectors[i].optionTexts[j] != selectors[i].defaultValue)
+ select.lastChild.classList.add('focusable');
+ else
+ select.lastChild.classList.add('bold');
+ if (harnessConfig.testType.includes(selectors[i].id)) {
+ switchDiv.appendChild(document.createTextNode(selectors[i].text));
+ var select = document.createElement('span');
+ select.id = selectors[i].id;
+ for (var j = 0; j < selectors[i].optionTexts.length; ++j) {
+ select.appendChild(createAnchor(selectors[i].optionTexts[j], selectors[i].optionTexts[j]));
+ let url = `${location.origin}?test_type=${harnessConfig.testType}`
+ url += `&engine_${selectors[i].id}=${selectors[i].optionTexts[j]}`
+ select.lastChild.setAttribute('data-href', url);
+ select.lastChild.onclick = window.navigate;
+ if (selectors[i].optionTexts[j] != selectors[i].defaultValue)
+ select.lastChild.classList.add('focusable');
+ else
+ select.lastChild.classList.add('bold');
+ }
+ switchDiv.appendChild(select);
}
- select.onchange = selectors[i].cb;
switchDiv.appendChild(select);
- switchDiv.appendChild(select);
}

switchDiv.appendChild(
diff --git a/harness/timeout.js b/harness/timeout.js
index 7c373c1..b4167ca 100644
--- a/harness/timeout.js
Expand Down Expand Up @@ -453,3 +451,30 @@ index 7c373c1..b4167ca 100644
this.setInterval = function(func, timeout) {
var interval = getUniqueItem(intervals);
interval.func = func;
diff --git a/style.css b/style.css
index 79f5cb1..8fbf2cb 100644
--- a/style.css
+++ b/style.css
@@ -23,6 +23,9 @@ body {
height: 710px;
}

+.bold {
+ font-weight: bold;
+}

.default-list .cell-category {
display: inline-block;
@@ -202,7 +205,8 @@ div.container_hidden {
}

#controls {
- display: inline-block;
+ display: block;
+ margin: 5px 0;
}

#login-pop-up {
--
2.25.1

0 comments on commit fe8142f

Please sign in to comment.