Fix browser test failed assertions and a bug in 'common-component-base'
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2018 04:40:42 +0000 (04:40 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2018 04:40:42 +0000 (04:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186423

Reviewed by Ryosuke Niwa.

Fixed serveral assertion failures in browser tests.
Fixed a bug in common-component-base that null/undefined as attribute value is not allowed.

* browser-tests/chart-revision-range-tests.js: Should not import 'lazily-evaluated-function.js' twice.
* browser-tests/chart-status-evaluator-tests.js: Should not import 'lazily-evaluated-function.js' twice.
* browser-tests/component-base-tests.js: Added a unit test for element attributes being null or undefined.
* browser-tests/index.html: Make mocked data from makeSampleCluster also contains commit_order.
* public/shared/common-component-base.js: Make it allow to take null as attribute value.
(CommonComponentBase.createElement):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232614 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/browser-tests/chart-revision-range-tests.js
Websites/perf.webkit.org/browser-tests/chart-status-evaluator-tests.js
Websites/perf.webkit.org/browser-tests/component-base-tests.js
Websites/perf.webkit.org/browser-tests/index.html
Websites/perf.webkit.org/public/shared/common-component-base.js

index 46d3bb4..1308a05 100644 (file)
@@ -1,3 +1,20 @@
+2018-06-07  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Fix browser test failed assertions and a bug in 'common-component-base'
+        https://bugs.webkit.org/show_bug.cgi?id=186423
+
+        Reviewed by Ryosuke Niwa.
+
+        Fixed serveral assertion failures in browser tests.
+        Fixed a bug in common-component-base that null/undefined as attribute value is not allowed.
+
+        * browser-tests/chart-revision-range-tests.js: Should not import 'lazily-evaluated-function.js' twice.
+        * browser-tests/chart-status-evaluator-tests.js: Should not import 'lazily-evaluated-function.js' twice.
+        * browser-tests/component-base-tests.js: Added a unit test for element attributes being null or undefined.
+        * browser-tests/index.html: Make mocked data from makeSampleCluster also contains commit_order.
+        * public/shared/common-component-base.js: Make it allow to take null as attribute value.
+        (CommonComponentBase.createElement):
+
 2018-05-24  Dewei Zhu  <dewei_zhu@apple.com>
 
         Added sending notification feature when test group finishes.
index b1b7066..89451d0 100644 (file)
@@ -5,7 +5,7 @@ describe('ChartRevisionRange', () => {
     {
         return ChartTest.importChartScripts(context).then(() => {
             ChartTest.makeModelObjectsForSampleCluster(context);
-            return context.importScripts(['lazily-evaluated-function.js', 'components/chart-revision-range.js'], 'ChartRevisionRange');
+            return context.importScripts(['components/chart-revision-range.js'], 'ChartRevisionRange');
         });
     }
 
index aeb7a80..d935c46 100644 (file)
@@ -3,9 +3,7 @@ describe('ChartStatusEvaluator', () => {
 
     function importEvaluator(context)
     {
-        const scripts = [
-            'lazily-evaluated-function.js',
-            'components/chart-status-evaluator.js'];
+        const scripts = ['components/chart-status-evaluator.js'];
 
         return ChartTest.importChartScripts(context).then(() => {
             return context.importScripts(scripts, 'Test', 'Metric', 'ChartStatusEvaluator');
index 897c24f..adef69f 100644 (file)
@@ -519,6 +519,19 @@ describe('ComponentBase', function() {
             });
         });
 
+        it('should allow to create an element with attributes to be null or undefined', () => {
+            const context = new BrowsingContext();
+            return importComponentBase(context).then((ComponentBase) => {
+                const input = ComponentBase.createElement('input', {'title': null, 'required': undefined});
+                expect(input).to.be.a(context.global.HTMLInputElement);
+                expect(input.attributes.length).to.be(2);
+                expect(input.attributes[0].localName).to.be('title');
+                expect(input.attributes[0].value).to.be('null');
+                expect(input.attributes[1].localName).to.be('required');
+                expect(input.attributes[1].value).to.be('undefined');
+            });
+        });
+
         it('should create an element with the specified attributes', () => {
             const context = new BrowsingContext();
             return importComponentBase(context).then((ComponentBase) => {
index 90f3c4d..217b964 100644 (file)
@@ -272,37 +272,37 @@ const ChartTest = {
             "current": [
                 [
                     1000, 100, 1, 100, 100 * 100, false,
-                    [ [2000, 1, "4000", posixTime('2016-01-05T17:35:00Z')], [3000, 2, "15B42", 0] ],
+                    [ [2000, 1, "4000", posixTime('2016-01-05T17:35:00Z')], [3000, 2, "15B42", 0, 0] ],
                     posixTime('2016-01-05T17:35:00Z'), 5000, posixTime('2016-01-05T19:23:00Z'), "10", 7
                 ],
                 [
                     1001, 131, 1, 131, 131 * 131, true,
-                    [ [2001, 1, "4001", posixTime('2016-01-05T18:43:01Z')], [3000, 2, "15B42", 0] ],
+                    [ [2001, 1, "4001", posixTime('2016-01-05T18:43:01Z')], [3000, 2, "15B42", 0, 0] ],
                     posixTime('2016-01-05T18:43:01Z'), 5001, posixTime('2016-01-05T20:58:01Z'), "11", 7
                 ],
                 [
                     1002, 122, 1, 122, 122 * 122, false,
-                    [ [2002, 1, "4002", posixTime('2016-01-05T20:01:02Z')], [3000, 2, "15B42", 0] ],
+                    [ [2002, 1, "4002", posixTime('2016-01-05T20:01:02Z')], [3000, 2, "15B42", 0, 0] ],
                     posixTime('2016-01-05T20:01:02Z'), 5002, posixTime('2016-01-05T22:37:02Z'), "12", 7
                 ],
                 [
                     1003, 113, 1, 113, 113 * 113, false,
-                    [ [2003, 1, "4003", posixTime('2016-01-05T23:19:03Z')], [3000, 2, "15B42", 0] ],
+                    [ [2003, 1, "4003", posixTime('2016-01-05T23:19:03Z')], [3000, 2, "15B42", 0, 0] ],
                     posixTime('2016-01-05T23:19:03Z'), 5003, posixTime('2016-01-06T23:19:03Z'), "13", 7
                 ],
                 [
                     1004, 124, 1, 124, 124 * 124, false,
-                    [ [2004, 1, "4004", posixTime('2016-01-06T01:52:04Z')], [3001, 2, "15C50", 0] ],
+                    [ [2004, 1, "4004", posixTime('2016-01-06T01:52:04Z')], [3001, 2, "15C50", 0, 0] ],
                     posixTime('2016-01-06T01:52:04Z'), 5004, posixTime('2016-01-06T02:42:04Z'), "14", 7
                 ],
                 [
                     1005, 115, 1, 115, 115 * 115, true,
-                    [ [2005, 1, "4005", posixTime('2016-01-06T03:22:05Z')], [3001, 2, "15C50", 0] ],
+                    [ [2005, 1, "4005", posixTime('2016-01-06T03:22:05Z')], [3001, 2, "15C50", 0, 0] ],
                     posixTime('2016-01-06T03:22:05Z'), 5005, posixTime('2016-01-06T06:01:05Z'), "15", 7
                 ],
                 [
                     1006, 116, 1, 116, 116 * 116, false,
-                    [ [2006, 1, "4006", posixTime('2016-01-06T05:59:06Z')], [3001, 2, "15C50", 0] ],
+                    [ [2006, 1, "4006", posixTime('2016-01-06T05:59:06Z')], [3001, 2, "15C50", 0, 0] ],
                     posixTime('2016-01-06T05:59:06Z'), 5006, posixTime('2016-01-06T08:34:06Z'), "16", 7
                 ]
             ],
index aafc908..799113f 100644 (file)
@@ -112,7 +112,7 @@ class CommonComponentBase {
                 else if (attributes[name] === true)
                     element.setAttribute(name, '');
                 else if (attributes[name] !== false)
-                    element.setAttribute(name, attributes[name].toString());
+                    element.setAttribute(name, attributes[name]);
             }
         }