Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
(GH1964) targets the proper DOM node for making a selection on the tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher McCulloh committed Jun 14, 2017
1 parent f15ca94 commit 7e6e4df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/markup/tree-markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<label class="control-label">Folders selectable</label>
<div class="form-group">

<ul id="MyTreeSelectableFolder" class="tree tree-folder-select" role="tree" aria-activedescendant="" aria-label="My Tree Selectable" aria-multiselectable=false>
<ul id="MyTreeSelectableFolder" class="tree tree-folder-select" role="tree" aria-activedescendant="" aria-label="My Tree Selectable" aria-multiselectable=false>
<li class="tree-branch hidden" data-template="treebranch" role="treeitem" aria-expanded="false" aria-selected="false">
<div class="tree-branch-header">
<button type="button" class="tree-branch-name" tabindex="-1">
Expand Down
10 changes: 5 additions & 5 deletions test/tree-tests/multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ define(function multiSelectWorksModuleFactory () {
folderSelect: true
});

this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch-name:eq(1)'));
this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch:eq(1)'));
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 1, 'Return single selected value');
this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch-name:eq(2)'));
this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch:eq(2)'));
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 2, 'Return multiple selected values');
this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch-name:eq(1)'));
this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch:eq(1)'));
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 1, 'Return single selected value');
});

Expand Down Expand Up @@ -58,8 +58,8 @@ define(function multiSelectWorksModuleFactory () {
folderSelect: true
});

var $toSelect1 = this.$selectableFolderTree.find('.tree-branch-name:eq(1)');
var $toSelect2 = this.$selectableFolderTree.find('.tree-branch-name:eq(2)');
var $toSelect1 = this.$selectableFolderTree.find('.tree-branch:eq(1)');
var $toSelect2 = this.$selectableFolderTree.find('.tree-branch:eq(2)');

assert.equal($toSelect1.attr('aria-selected'), 'false', "item 1's aria-selected attr present and set to false");
assert.equal($toSelect2.attr('aria-selected'), 'false', "item 2's aria-selected attr present and set to false");
Expand Down
6 changes: 3 additions & 3 deletions test/tree-tests/single-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define(function singleSelectWorksModuleFactory () {
this.$selectableFolderTree.tree('selectItem', this.$selectableFolderTree.find('.tree-item:eq(1)'));
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 1, 'Return single selected item (none previously selected, 1st programatic selection)');

this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch-name:eq(1)'));
this.$selectableFolderTree.tree('selectFolder', this.$selectableFolderTree.find('.tree-branch:eq(1)'));
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 1, 'Return single selected folder (item previously selected, 2nd programatic selection)');

this.$selectableFolderTree.tree('selectItem', this.$selectableFolderTree.find('.tree-item:eq(2)'));
Expand All @@ -33,7 +33,7 @@ define(function singleSelectWorksModuleFactory () {
this.$selectableFolderTree.find('.tree-item:eq(1)').click();
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 1, 'Return single selected item (item previously selected, 1st click selection)');

this.$selectableFolderTree.find('.tree-branch-name:eq(1)').click();
this.$selectableFolderTree.find('.tree-branch:eq(1)').click();
assert.equal(this.$selectableFolderTree.tree('selectedItems').length, 1, 'Return single selected folder (item previously selected, 2nd click selection)');

this.$selectableFolderTree.find('.tree-item:eq(2)').click();
Expand All @@ -60,7 +60,7 @@ define(function singleSelectWorksModuleFactory () {
folderSelect: true
});

var $toSelect = this.$selectableFolderTree.find('.tree-branch-name:eq(1)');
var $toSelect = this.$selectableFolderTree.find('.tree-branch:eq(1)');
assert.equal($toSelect.attr('aria-selected'), 'false', "item's aria-selected attr present and set to false");
this.$selectableFolderTree.tree('selectItem', $toSelect);
assert.ok($toSelect.attr('aria-selected'), 'newly selected item contains aria-selected="true"');
Expand Down

0 comments on commit 7e6e4df

Please sign in to comment.