Title: [238914] trunk
Revision
238914
Author
mattba...@apple.com
Date
2018-12-05 15:50:08 -0800 (Wed, 05 Dec 2018)

Log Message

Web Inspector: SelectionController should not extend the selection when allowsMultipleSelection is false
https://bugs.webkit.org/show_bug.cgi?id=192390
<rdar://problem/46473624>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController.prototype.selectItem):

LayoutTests:

* inspector/table/table-selection-expected.txt:
* inspector/table/table-selection.html:
Drive-by fix: removed `allowsMultipleSelection` check from test case
Table.SelectMultipleRows.ExtendSelection since it is tested in Table.AllowsMultipleSelection.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238913 => 238914)


--- trunk/LayoutTests/ChangeLog	2018-12-05 23:25:47 UTC (rev 238913)
+++ trunk/LayoutTests/ChangeLog	2018-12-05 23:50:08 UTC (rev 238914)
@@ -1,3 +1,16 @@
+2018-12-05  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: SelectionController should not extend the selection when allowsMultipleSelection is false
+        https://bugs.webkit.org/show_bug.cgi?id=192390
+        <rdar://problem/46473624>
+
+        Reviewed by Devin Rousso.
+
+        * inspector/table/table-selection-expected.txt:
+        * inspector/table/table-selection.html:
+        Drive-by fix: removed `allowsMultipleSelection` check from test case
+        Table.SelectMultipleRows.ExtendSelection since it is tested in Table.AllowsMultipleSelection.
+
 2018-12-05  Ryosuke Niwa  <rn...@webkit.org>
 
         Null pointer crash in DocumentOrderedMap::getElementById via FormAssociatedElement::findAssociatedForm

Modified: trunk/LayoutTests/inspector/table/table-selection-expected.txt (238913 => 238914)


--- trunk/LayoutTests/inspector/table/table-selection-expected.txt	2018-12-05 23:25:47 UTC (rev 238913)
+++ trunk/LayoutTests/inspector/table/table-selection-expected.txt	2018-12-05 23:50:08 UTC (rev 238914)
@@ -31,7 +31,6 @@
 PASS: allowsMultipleSelection disabled.
 
 -- Running test case: Table.SelectMultipleRows.ExtendSelection
-PASS: allowsMultipleSelection enabled.
 Selecting row 0.
 PASS: Table selection changed.
 PASS: selectedRow should be 0.
@@ -43,6 +42,15 @@
 PASS: selectedRow should be 9.
 PASS: selectedRows should be [0, 1, 9].
 
+-- Running test case: Table.SelectMultipleRows.ExtendSelection.MultipleSelectionDisabled
+Selecting row 0.
+PASS: Table selection changed.
+PASS: selectedRow should be 0.
+Selecting row 1.
+PASS: Table selection changed.
+PASS: selectedRow should be 1.
+PASS: selectedRows should be [1].
+
 -- Running test case: Table.SelectMultipleRows.SelectTheSameRowTwice.ExtendSelection
 Selecting row 0.
 PASS: Table selection changed.

Modified: trunk/LayoutTests/inspector/table/table-selection.html (238913 => 238914)


--- trunk/LayoutTests/inspector/table/table-selection.html	2018-12-05 23:25:47 UTC (rev 238913)
+++ trunk/LayoutTests/inspector/table/table-selection.html	2018-12-05 23:50:08 UTC (rev 238914)
@@ -78,6 +78,7 @@
             return true;
         }
     });
+
     suite.addTestCase({
         name: "Table.SelectMultipleRows.ExtendSelection",
         description: "Select multiple rows, extending the selection.",
@@ -84,7 +85,6 @@
         test() {
             let table = InspectorTest.createTable();
             table.allowsMultipleSelection = true;
-            InspectorTest.expectThat(table.allowsMultipleSelection, "allowsMultipleSelection enabled.");
 
             const extendSelection = true;
 
@@ -98,6 +98,23 @@
     });
 
     suite.addTestCase({
+        name: "Table.SelectMultipleRows.ExtendSelection.MultipleSelectionDisabled",
+        description: "Attempt to extend the selection when multiple selection is disabled.",
+        test() {
+            let table = InspectorTest.createTable();
+            table.allowsMultipleSelection = false;
+
+            const extendSelection = true;
+
+            triggerSelectRow(table, 0, extendSelection);
+            triggerSelectRow(table, 1, extendSelection);
+            InspectorTest.expectShallowEqual(table.selectedRows, [1], "selectedRows should be [1].");
+
+            return true;
+        }
+    });
+
+    suite.addTestCase({
         name: "Table.SelectMultipleRows.SelectTheSameRowTwice.ExtendSelection",
         description: "Select an already selected row, and extend the selection.",
         test() {

Modified: trunk/Source/WebInspectorUI/ChangeLog (238913 => 238914)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-12-05 23:25:47 UTC (rev 238913)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-12-05 23:50:08 UTC (rev 238914)
@@ -1,3 +1,14 @@
+2018-12-05  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: SelectionController should not extend the selection when allowsMultipleSelection is false
+        https://bugs.webkit.org/show_bug.cgi?id=192390
+        <rdar://problem/46473624>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Controllers/SelectionController.js:
+        (WI.SelectionController.prototype.selectItem):
+
 2018-12-04  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Add style editing debug mode

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js (238913 => 238914)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js	2018-12-05 23:25:47 UTC (rev 238913)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js	2018-12-05 23:50:08 UTC (rev 238914)
@@ -87,6 +87,9 @@
         console.assert(!extendSelection || this._allowsMultipleSelection, "Cannot extend selection with multiple selection disabled.");
         console.assert(index >= 0 && index < this.numberOfItems);
 
+        if (!this._allowsMultipleSelection)
+            extendSelection = false;
+
         if (this.hasSelectedItem(index)) {
             if (!extendSelection)
                 this._deselectAllAndSelect(index);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to