Skip to content

Commit

Permalink
[test|fix] fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
GarinZ committed Feb 10, 2023
1 parent 1e5c589 commit c2fe2e1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ module.exports = {
extends: '@yutengjing/eslint-config-react',
rules: {
'import/default': OFF,
'react/react-in-jsx-scope': OFF,
},
};
2 changes: 0 additions & 2 deletions src/tree/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import { TabMasterTree } from './components/tab-master-tree';

const App = () => (
Expand Down
7 changes: 3 additions & 4 deletions src/tree/plugins/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ export const FILTER_OPTIONS: Fancytree.FilterOptions = {
mode: 'dimm', // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
};

export const registerSearchEventHandler = (tree: Fancytree.Fancytree) => {
export function registerSearchEventHandler(tree: Fancytree.Fancytree) {
const $searchButton = $('button#btnResetSearch');
$('input[name=search]')
.on('keyup', function (e) {
const filterFunc = tree.filterNodes;
const match: string = String($(this).val()) ?? '';
if ((e && e.which === $.ui.keyCode.ESCAPE) || $.trim(match) === '') {
$searchButton.trigger('click');
return;
}
const n = filterFunc(match);
const n = tree.filterNodes(match);
$searchButton.attr('disabled');
$('span#matches').text(`(${n} matches)`);
})
Expand All @@ -34,4 +33,4 @@ export const registerSearchEventHandler = (tree: Fancytree.Fancytree) => {
tree.clearFilter();
})
.attr('disabled');
};
}
2 changes: 1 addition & 1 deletion test/tree/fancy-tab-master-tree/click-event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('db click', () => {

it('db click on closed tab without window node', async () => {
const tree = initTabMasterTree([DEFAULT_TAB_NODE]).tree;
const toClickNode = tree.getNodeByKey(DEFAULT_TAB_NODE.key);
const toClickNode = tree.getNodeByKey(DEFAULT_TAB_NODE.key!);
const modifiedWindowId = 2;
TabNodeOperations.updatePartial(toClickNode, { closed: true });
browser.windows.create.returns(
Expand Down
2 changes: 1 addition & 1 deletion test/utils/gen-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import 'jquery.fancytree/dist/modules/jquery.fancytree.childcounter';

export function initTabMasterTree(source: TreeNode<TreeData>[]): FancyTabMasterTree {
document.body.innerHTML = '<div id="tree">';
const tree = new FancyTabMasterTree('#tree');
const tree = new FancyTabMasterTree($('#tree'));
tree.initTree(source);
return tree;
}
Expand Down

0 comments on commit c2fe2e1

Please sign in to comment.