Skip to content

Commit 2b49af1

Browse files
committed
hovering test case over suite will place it atop the suite
1 parent 0b874fe commit 2b49af1

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

packages/selenium-ide/src/neo/components/Suite/index.jsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@ import ListMenu, { ListMenuItem } from "../ListMenu";
3030
import MoreButton from "../ActionButtons/More";
3131
import "./style.css";
3232

33-
function containsTest(tests, test) {
34-
return tests.find((currTest) => (currTest.id === test.id));
35-
}
36-
3733
const testTarget = {
3834
canDrop(props, monitor) {
39-
const test = monitor.getItem();
40-
return !containsTest(props.suite.tests, test);
35+
const test = monitor.getItem().test;
36+
return !props.suite.containsTest(props.suite.tests, test);
4137
},
42-
drop(props, monitor) {
43-
if (monitor.didDrop()) {
38+
hover(props, monitor) {
39+
// check if they are different suites
40+
const dragged = monitor.getItem();
41+
if (monitor.canDrop() && props.suite !== dragged.suite) {
42+
dragged.suite.removeTestCase(dragged.test);
43+
props.suite.insertTestCaseAt(dragged.test, 0);
44+
dragged.suite = props.suite;
45+
dragged.index = 0;
4446
return;
4547
}
46-
47-
props.moveTest(monitor.getItem(), props.suite);
4848
}
4949
};
5050

5151
function collect(connect, monitor) {
5252
return {
5353
connectDropTarget: connect.dropTarget(),
54-
isOver: monitor.isOver(),
54+
isOver: monitor.isOver({ shallow: true }),
5555
canDrop: monitor.canDrop()
5656
};
5757
}
@@ -101,16 +101,18 @@ class Suite extends React.Component {
101101
//setting component of context menu.
102102
this.props.setContextMenu(listMenu);
103103

104-
return this.props.connectDropTarget(
104+
return (
105105
<div onKeyDown={this.handleKeyDown.bind(this)} >
106106
<div className="project" onContextMenu={this.props.onContextMenu} >
107-
<a href="#" tabIndex="-1" className={classNames(PlaybackState.suiteState.get(this.props.suite.id), { "hover": (this.props.isOver && this.props.canDrop) }, { "active": this.store.isOpen })} onClick={this.handleClick} >
108-
<span className="si-caret"></span>
109-
<span className="title">{this.props.suite.name}</span>
110-
</a>
107+
{this.props.connectDropTarget(
108+
<a href="#" tabIndex="-1" className={classNames(PlaybackState.suiteState.get(this.props.suite.id), { "active": this.store.isOpen })} onClick={this.handleClick} >
109+
<span className="si-caret"></span>
110+
<span className="title">{this.props.suite.name}</span>
111+
</a>
112+
)}
111113
{listMenu}
112114
</div>
113-
<TestList collapsed={!this.store.isOpen} suite={this.props.suite} tests={this.store.filteredTests.get()} removeTest={(test) => {
115+
<TestList collapsed={this.store.isOpen} suite={this.props.suite} tests={this.store.filteredTests.get()} removeTest={(test) => {
114116
this.props.suite.removeTestCase(test);
115117
UiState.selectTest();
116118
}} />

packages/selenium-ide/src/neo/components/Suite/style.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
min-width: 0;
1414
}
1515

16-
.project > a.hover {
17-
border-bottom: 1px #40A6FF solid;
18-
}
19-
2016
.project > a .title {
2117
padding: 0 6px;
2218
font-size: 14px;

0 commit comments

Comments
 (0)