}
handleSvgClick(event) {
- console.debug("svg click event received");
if (this.state.clickable) {
var elementName = event.target.parentNode.getAttribute('policyId');
console.info("SVG element clicked", elementName);
xPos += (this.boxWidth + this.boxSpace);
allElements.push(this.createOneArrow(xPos - this.boxSpace));
- //createOneBox(xPos, policyId, loopElementModelId , name, title, policyType)
for (var loopElement of this.state.loopCache.getAllLoopElementModels()) {
allElements.push(this.createOneBox(xPos,
}
renderSvg() {
+ console.log('renderSvg called');
if (this.state.loopCache.getLoopName() === undefined) {
return [emptySvg];
}
import toJson from "enzyme-to-json";
import React from "react";
import SvgGenerator from "./SvgGenerator";
+import {Router} from "react-router-dom";
+import {createMemoryHistory} from "history";
+import LoopCache from "../../../api/LoopCache";
+import {act} from "react-dom/test-utils";
+
+const logSpy = jest.spyOn(console, 'log')
+const history = createMemoryHistory();
describe('Verify SvgGenerator', () => {
it("renders correctly", () => {
- const component = shallow(<SvgGenerator />);
+ const component = shallow(<SvgGenerator/>);
expect(toJson(component)).toMatchSnapshot();
});
+
+ it("Test renderSvg called", () => {
+ shallow(
+ <Router history={history}>
+ <SvgGenerator loopCache={new LoopCache({})} clickable={ true } generatedFrom='INSTANCE' isBusyLoading={false}/>
+ </Router>
+ );
+
+ act(async () => {
+ expect(logSpy).toHaveBeenCalledWith('renderSvg called');
+ });
+ });
+
+ it("Test svg click event received", () => {
+ const component = shallow(
+ <Router history={history}>
+ <SvgGenerator loopCache={new LoopCache({})} clickable={ true } generatedFrom='INSTANCE' isBusyLoading={false}/>
+ </Router>
+ );
+
+ act(async () => {
+ component.find('withRouter(SvgGenerator)').simulate('click');
+ expect(logSpy).toHaveBeenCalledWith('svg click event received');
+ });
+ });
});
\ No newline at end of file
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ${ props => props.theme.menuHighlightedBackgroundColor };
color: ${ props => props.theme.menuHighlightedFontColor };
- }
-`;
+ }`;
const StyledNavLink = styled(Nav.Link)`
color: ${ props => props.theme.menuFontColor };
background-color: ${ props => props.theme.menuBackgroundColor };
font-weight: normal;
padding: .25rem 1.5rem;
-
:hover {
background-color: ${ props => props.theme.menuHighlightedBackgroundColor };
color: ${ props => props.theme.menuHighlightedFontColor };
- }
-`;
+ }`;
const StyledNavDropdown = styled(NavDropdown)`
color: ${ props => props.theme.menuFontColor };
:hover {
font-weight: bold;
}
- }
-`;
+ }`;
export default class MenuBar extends React.Component {
state = {
it('Finds POLICY Framework Menu', () => {
const component = shallow(<MenuBar />).childAt(4).dive();
- expect(component.find({ tile: 'TOSCA Control Loop' }));
+ expect(component.find({ tile: 'TOSCA Automation Composition' }));
});
it('Finds POLICY Framework Menu', () => {
const component = shallow(<MenuBar />);
expect(component.find('Styled(NavLink)').length).toEqual(2);
});
+
+ it('Finds StyledNavDropdown', () => {
+ const component = shallow(<MenuBar />);
+ expect(component.find('Styled(NavDropdown)').length).toEqual(6);
+ });
});
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},
text-align: inherit;
white-space: nowrap;
border: 0;
-
:hover {
text-decoration: none;
background-color: ",
color: ",
[Function],
";
- }
-",
+ }",
],
"staticRulesId": "",
},