Commit 6f87c633 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH

updated tc block editor to have save/cancel func, fixes #129 and #134, maybe #110

parent 8cc308f8
Pipeline #24813 passed with stages
in 42 minutes and 52 seconds
......@@ -529,7 +529,7 @@ export default class GraphicalEditor extends React.PureComponent<Props, State> {
// check in endDrag() if the distance travelled is small
// enough to be considered a click or not
function startDrag(d) {
console.log('startDrag');
//console.log('startDrag');
startX = d3.event.x;
startY = d3.event.y;
// find the block that the user started from
......@@ -553,7 +553,7 @@ export default class GraphicalEditor extends React.PureComponent<Props, State> {
const processEndBlock = (endInput: HTMLElement) => {
if(!startBlock)
return;
console.log(endInput);
//console.log(endInput);
const endId = endInput.id.replace('-input-', '.');
// create a new connection assuming theres a given func that does it
if(createConnection)
......
......@@ -315,7 +315,7 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
wrapper.find('.modal CacheInput[value="output0"]').prop('onChange')( { target: { value: 'species' }});
wrapper.update();
wrapper.find('button.close').simulate('click');
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.find('ToolchainModal').props().active).to.equal(false);
......@@ -331,6 +331,7 @@ describe('<ToolchainEditor />', function() {
wrapper.find('rect#block_dataset0').simulate('click');
wrapper.update();
expect(wrapper.find('ToolchainModal').props().active).to.equal(true);
wrapper.update();
expect(wrapper.find('.modal').find('CacheInput#tcModalInitFocus').props().value).to.equal('dataset0');
wrapper.find('.modal').find('CacheInput#tcModalInitFocus').prop('onChange')( { target: { value: 'testing_data' }});
wrapper.update();
......@@ -344,7 +345,7 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
wrapper.find('.modal CacheInput[value="output0"]').prop('onChange')( { target: { value: 'species' }});
wrapper.update();
wrapper.find('button.close').simulate('click');
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.props().data.contents.datasets[1]).to.deep.equal({
......@@ -376,7 +377,7 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
wrapper.find('.modal CacheInput[value="output"]').prop('onChange')( { target: { value: 'lda_machine' }});
wrapper.update();
wrapper.find('button.close').simulate('click');
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.props().data.contents.blocks[0]).to.deep.equal({
......@@ -412,7 +413,7 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
wrapper.find('.modal CacheInput[value="output"]').prop('onChange')( { target: { value: 'scores' }});
wrapper.update();
wrapper.find('button.close').simulate('click');
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.props().data.contents.blocks[1]).to.deep.equal({
......@@ -442,7 +443,7 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
wrapper.find('.modal CacheInput[value="input0"]').prop('onChange')( { target: { value: 'species' }});
wrapper.update();
wrapper.find('button.close').simulate('click');
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.props().data.contents.analyzers[0]).to.deep.equal({
......@@ -964,12 +965,13 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
expect(wrapper.find('ToolchainModal').props().active).to.equal(true);
wrapper.find('.modal CacheInput[value="lda_machine"]').prop('onChange')( { target: { value: 'lda' }});
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.find('.modal CacheInput[value="lda"]').props().value).to.equal('lda');
const data = wrapper.props().data;
expect(data.contents.representation.connections).to.have.property('training_alg.lda_machine/testing_alg.lda');
expect(data.contents.representation.connections).to.not.have.property('training_alg.lda_machine/testing_alg.lda_machine');
expect(data.contents.representation.connections).to.have.property('training_alg.lda_machine/testing_alg.lda');
});
it('Properly changes connection names when renaming an output', () => {
......@@ -993,12 +995,13 @@ describe('<ToolchainEditor />', function() {
wrapper.update();
expect(wrapper.find('ToolchainModal').props().active).to.equal(true);
wrapper.find('.modal CacheInput[value="lda_machine"]').prop('onChange')( { target: { value: 'lda' }});
wrapper.find('.modal button.btn-success').simulate('click');
wrapper.update();
expect(wrapper.find('.modal CacheInput[value="lda"]').props().value).to.equal('lda');
const data = wrapper.props().data;
expect(data.contents.representation.connections).to.have.property('training_alg.lda/testing_alg.lda_machine');
expect(data.contents.representation.connections).to.not.have.property('training_alg.lda_machine/testing_alg.lda_machine');
expect(data.contents.representation.connections).to.have.property('training_alg.lda/testing_alg.lda_machine');
});
it('Properly deletes the training_data.species/training_alg.species connection', async () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment