feat(tests): add tests

This commit is contained in:
moklick
2019-09-26 14:31:59 +02:00
parent 590d7c7db0
commit 7b3a90c6dc
9 changed files with 27 additions and 15 deletions
+16
View File
@@ -7,10 +7,18 @@ describe('Basic Flow Rendering', () => {
cy.get('.react-graph__edge').should('have.length', 2); 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', () => { it('selects a node', () => {
cy.get('.react-graph__node:first').click().should('have.class', 'selected'); 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', () => { it('drags a node', () => {
const styleBeforeDrag = Cypress.$('.react-graph__node:first').css('transform'); const styleBeforeDrag = Cypress.$('.react-graph__node:first').css('transform');
@@ -20,4 +28,12 @@ describe('Basic Flow Rendering', () => {
expect(styleBeforeDrag).to.not.equal(styleAfterDrag); 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);
});
}); });
+1 -1
View File
@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; 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) { ws.onmessage = function (event) {
checkedAssets = {}; checkedAssets = {};
+1 -1
View File
@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; 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) { ws.onmessage = function (event) {
checkedAssets = {}; checkedAssets = {};
+2 -3
View File
@@ -45169,8 +45169,7 @@ var _default = function _default(_ref) {
var data = _ref.data, var data = _ref.data,
style = _ref.style; style = _ref.style;
return _react.default.createElement("div", { return _react.default.createElement("div", {
style: _objectSpread({}, nodeStyles, {}, style), style: _objectSpread({}, nodeStyles, {}, style)
className: "react-graph__node-inner"
}, data.label, _react.default.createElement(_Handle.default, { }, data.label, _react.default.createElement(_Handle.default, {
type: "source", type: "source",
position: "bottom" position: "bottom"
@@ -46364,7 +46363,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; 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) { ws.onmessage = function (event) {
checkedAssets = {}; checkedAssets = {};
File diff suppressed because one or more lines are too long
+2 -3
View File
@@ -45169,8 +45169,7 @@ var _default = function _default(_ref) {
var data = _ref.data, var data = _ref.data,
style = _ref.style; style = _ref.style;
return _react.default.createElement("div", { return _react.default.createElement("div", {
style: _objectSpread({}, nodeStyles, {}, style), style: _objectSpread({}, nodeStyles, {}, style)
className: "react-graph__node-inner"
}, data.label, _react.default.createElement(_Handle.default, { }, data.label, _react.default.createElement(_Handle.default, {
type: "source", type: "source",
position: "bottom" position: "bottom"
@@ -46718,7 +46717,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; 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) { ws.onmessage = function (event) {
checkedAssets = {}; checkedAssets = {};
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -47,7 +47,8 @@
"watch": "rollup -w -c", "watch": "rollup -w -c",
"dev": "parcel examples/*.html -d examples/build", "dev": "parcel examples/*.html -d examples/build",
"build:example": "parcel build examples/*.html -d examples/build", "build:example": "parcel build examples/*.html -d examples/build",
"cypress": "cypress open" "cypress": "cypress open",
"test": "cypress run"
}, },
"husky": { "husky": {
"hooks": {} "hooks": {}
+1 -4
View File
@@ -10,10 +10,7 @@ const nodeStyles = {
}; };
export default ({ data, style }) => ( export default ({ data, style }) => (
<div <div style={{ ...nodeStyles, ...style }}>
style={{ ...nodeStyles, ...style }}
className="react-graph__node-inner"
>
{data.label} {data.label}
<Handle type="source" position="bottom" /> <Handle type="source" position="bottom" />
</div> </div>