Update Add Host Modal Styles & Tests (#1068)

This commit is contained in:
Kyle Knight 2017-01-20 18:10:58 -06:00 committed by Jason Meller
parent 378331ab58
commit 3e3588706b
4 changed files with 27 additions and 10 deletions

View File

@ -18,7 +18,10 @@ class AddHostModal extends Component {
constructor (props) {
super(props);
this.state = { revealSecret: false };
this.state = {
revealSecret: false,
secretText: '1234567890',
};
}
onCopySecret = (elementClass) => {
@ -95,7 +98,7 @@ class AddHostModal extends Component {
inputWrapperClass={`${baseClass}__secret-input`}
name="osqueryd-secret"
type={revealSecret ? 'text' : 'password'}
value="1234567890"
value={this.state.secretText}
/>
<Button variant="unstyled" className={`${baseClass}__secret-copy-icon`} onClick={onCopySecret(`.${baseClass}__secret-input`)}>
<Icon name="clipboard" />

View File

@ -120,6 +120,10 @@
right: 10px;
font-size: 18px;
color: $link;
&:active {
top: 8px;
}
}
&__secret-input {

View File

@ -93,14 +93,6 @@ export class ManageHostsPage extends Component {
return false;
}
onAddHostSubmit = () => {
const { toggleAddHostModal } = this;
toggleAddHostModal();
return false;
}
onAddHostClick = (evt) => {
evt.preventDefault();

View File

@ -246,4 +246,22 @@ describe('ManageHostsPage - component', () => {
expect(hostActions.destroy).toHaveBeenCalledWith(offlineHost);
});
});
describe('Add Host', () => {
it('Open the Add Host modal from sidebar', () => {
const page = mount(<ManageHostsPage {...props} hosts={[]} selectedLabel={allHostsLabel} />);
const addNewHost = page.find('.host-side-panel__add-hosts');
addNewHost.simulate('click');
expect(page.find('AddHostModal').length).toEqual(1);
});
it('Open the Add Host modal from Lonely Host', () => {
const page = mount(<ManageHostsPage {...props} hosts={[]} selectedLabel={allHostsLabel} />);
const addNewHost = page.find('LonelyHost').find('Button');
addNewHost.simulate('click');
expect(page.find('AddHostModal').length).toEqual(1);
});
});
});