2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 import { expect } from 'chai';
24 import React from 'react';
25 import TestUtils from 'react-dom/lib/ReactTestUtils';
26 import InlineMessage from 'generic-components/InlineMessage/InlineMessage.jsx';
27 import InlineMessageConstants from 'generic-components/InlineMessage/InlineMessageConstants.js';
29 describe('Core Inline Message Suite', function() {
36 beforeEach(function() {
37 _warningMessage = TestUtils.renderIntoDocument(<InlineMessage level='warning' messageTxt='Warning Message' />);
38 _successMessage = TestUtils.renderIntoDocument(<InlineMessage level='success' messageTxt='Success Message' />);
39 _dangerMessage = TestUtils.renderIntoDocument(<InlineMessage level='danger' messageTxt='Danger Message' />);
40 _defaultMessage = TestUtils.renderIntoDocument(<InlineMessage level='info' messageTxt='Info Message' />);
44 it('Inline Message - validate success message panel', function() {
45 let alertPanel = TestUtils.findRenderedDOMComponentWithClass(_successMessage, 'alert');
46 expect(alertPanel).to.exist; // alert panel exists
47 let alertPanel_style = TestUtils.findRenderedDOMComponentWithClass(_successMessage, 'alert-success');
48 expect(alertPanel_style).to.exist; // alert panel has proper styling
49 let messagePanel = TestUtils.findRenderedDOMComponentWithClass(_successMessage, InlineMessageConstants.MESSAGE_PANEL_CLASSNAME);
50 expect(messagePanel).to.exist;
51 expect(messagePanel.innerHTML).to.have.string('Success Message'); // messagePanel panel has proper message
52 let iconPanel = TestUtils.findRenderedDOMComponentWithClass(_successMessage, InlineMessageConstants.ICON_PANEL_CLASSNAME);
53 expect(iconPanel).to.exist;
54 expect(iconPanel.innerHTML).to.have.string(InlineMessageConstants.SUCCESS_CLASSNAME); // notification panel has proper styling
56 it('Inline Message - validate info message panel', function() {
57 let alertPanel = TestUtils.findRenderedDOMComponentWithClass(_defaultMessage, 'alert');
58 expect(alertPanel).to.exist; // alert panel exists
59 let alertPanel_style = TestUtils.findRenderedDOMComponentWithClass(_defaultMessage, 'alert-info');
60 expect(alertPanel_style).to.exist; // alert panel has proper styling
61 let messagePanel = TestUtils.findRenderedDOMComponentWithClass(_defaultMessage, InlineMessageConstants.MESSAGE_PANEL_CLASSNAME);
62 expect(messagePanel).to.exist;
63 expect(messagePanel.innerHTML).to.have.string('Info Message'); // messagePanel panel has proper message
64 let iconPanel = TestUtils.findRenderedDOMComponentWithClass(_defaultMessage, InlineMessageConstants.ICON_PANEL_CLASSNAME);
65 expect(iconPanel).to.exist;
66 expect(iconPanel.innerHTML).to.have.string(InlineMessageConstants.DEFAULT_CLASSNAME); // icon panel has proper styling
68 it('Inline Message - validate warning message panel', function() {
69 let alertPanel = TestUtils.findRenderedDOMComponentWithClass(_warningMessage, 'alert');
70 expect(alertPanel).to.exist; // alert panel exists
71 let alertPanel_style = TestUtils.findRenderedDOMComponentWithClass(_warningMessage, 'alert-warning');
72 expect(alertPanel_style).to.exist; // alert panel has proper styling
73 let messagePanel = TestUtils.findRenderedDOMComponentWithClass(_warningMessage, InlineMessageConstants.MESSAGE_PANEL_CLASSNAME);
74 expect(messagePanel).to.exist;
75 expect(messagePanel.innerHTML).to.have.string('Warning Message'); // messagePanel panel has proper message
76 let iconPanel = TestUtils.findRenderedDOMComponentWithClass(_warningMessage, InlineMessageConstants.ICON_PANEL_CLASSNAME);
77 expect(iconPanel).to.exist;
78 expect(iconPanel.innerHTML).to.have.string(InlineMessageConstants.WARNING_CLASSNAME); // icon panel has proper styling
80 it('Inline Message - validate danger message panel', function() {
81 let alertPanel = TestUtils.findRenderedDOMComponentWithClass(_dangerMessage, 'alert');
82 expect(alertPanel).to.exist; // alert panel exists
83 let alertPanel_style = TestUtils.findRenderedDOMComponentWithClass(_dangerMessage, 'alert-danger');
84 expect(alertPanel_style).to.exist; // alert panel has proper styling
85 let messagePanel = TestUtils.findRenderedDOMComponentWithClass(_dangerMessage, InlineMessageConstants.MESSAGE_PANEL_CLASSNAME);
86 expect(messagePanel).to.exist;
87 expect(messagePanel.innerHTML).to.have.string('Danger Message'); // messagePanel panel has proper message
88 let iconPanel = TestUtils.findRenderedDOMComponentWithClass(_dangerMessage, InlineMessageConstants.ICON_PANEL_CLASSNAME);
89 expect(iconPanel).to.exist;
90 expect(iconPanel.innerHTML).to.have.string(InlineMessageConstants.DANGER_CLASSNAME); // icon panel has proper styling