feat(tests): add tests
This commit is contained in:
@@ -7,10 +7,18 @@ describe('Basic Flow Rendering', () => {
|
||||
cy.get('.react-graph__edge').should('have.length', 2);
|
||||
});
|
||||
|
||||
it('all nodes have handles', () => {
|
||||
cy.get('.react-graph__node').children('div').children('.react-graph__handle');
|
||||
});
|
||||
|
||||
it('selects a node', () => {
|
||||
cy.get('.react-graph__node:first').click().should('have.class', 'selected');
|
||||
});
|
||||
|
||||
it('selects an edge', () => {
|
||||
cy.get('.react-graph__edge:first').click().should('have.class', 'selected');
|
||||
});
|
||||
|
||||
it('drags a node', () => {
|
||||
const styleBeforeDrag = Cypress.$('.react-graph__node:first').css('transform');
|
||||
|
||||
@@ -20,4 +28,12 @@ describe('Basic Flow Rendering', () => {
|
||||
expect(styleBeforeDrag).to.not.equal(styleAfterDrag);
|
||||
});
|
||||
});
|
||||
|
||||
it('removes a node', () => {
|
||||
cy.get('.react-graph__node:last').click();
|
||||
cy.get('body').type('{backspace}');
|
||||
|
||||
cy.get('.react-graph__node').should('have.length', 2);
|
||||
cy.get('.react-graph__edge').should('have.length', 1);
|
||||
});
|
||||
});
|
||||
@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||
var hostname = "" || location.hostname;
|
||||
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "52266" + '/');
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "64998" + '/');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
checkedAssets = {};
|
||||
|
||||
@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||
var hostname = "" || location.hostname;
|
||||
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "52266" + '/');
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "64998" + '/');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
checkedAssets = {};
|
||||
|
||||
@@ -45169,8 +45169,7 @@ var _default = function _default(_ref) {
|
||||
var data = _ref.data,
|
||||
style = _ref.style;
|
||||
return _react.default.createElement("div", {
|
||||
style: _objectSpread({}, nodeStyles, {}, style),
|
||||
className: "react-graph__node-inner"
|
||||
style: _objectSpread({}, nodeStyles, {}, style)
|
||||
}, data.label, _react.default.createElement(_Handle.default, {
|
||||
type: "source",
|
||||
position: "bottom"
|
||||
@@ -46364,7 +46363,7 @@ var parent = module.bundle.parent;
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||
var hostname = "" || location.hostname;
|
||||
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "52266" + '/');
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "64998" + '/');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
checkedAssets = {};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -45169,8 +45169,7 @@ var _default = function _default(_ref) {
|
||||
var data = _ref.data,
|
||||
style = _ref.style;
|
||||
return _react.default.createElement("div", {
|
||||
style: _objectSpread({}, nodeStyles, {}, style),
|
||||
className: "react-graph__node-inner"
|
||||
style: _objectSpread({}, nodeStyles, {}, style)
|
||||
}, data.label, _react.default.createElement(_Handle.default, {
|
||||
type: "source",
|
||||
position: "bottom"
|
||||
@@ -46718,7 +46717,7 @@ var parent = module.bundle.parent;
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||
var hostname = "" || location.hostname;
|
||||
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "52266" + '/');
|
||||
var ws = new WebSocket(protocol + '://' + hostname + ':' + "64998" + '/');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
checkedAssets = {};
|
||||
|
||||
File diff suppressed because one or more lines are too long
+2
-1
@@ -47,7 +47,8 @@
|
||||
"watch": "rollup -w -c",
|
||||
"dev": "parcel examples/*.html -d examples/build",
|
||||
"build:example": "parcel build examples/*.html -d examples/build",
|
||||
"cypress": "cypress open"
|
||||
"cypress": "cypress open",
|
||||
"test": "cypress run"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {}
|
||||
|
||||
@@ -10,10 +10,7 @@ const nodeStyles = {
|
||||
};
|
||||
|
||||
export default ({ data, style }) => (
|
||||
<div
|
||||
style={{ ...nodeStyles, ...style }}
|
||||
className="react-graph__node-inner"
|
||||
>
|
||||
<div style={{ ...nodeStyles, ...style }}>
|
||||
{data.label}
|
||||
<Handle type="source" position="bottom" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user