Skip to content

Commit

Permalink
Fix pacifica#25 Update Single Object Broken
Browse files Browse the repository at this point in the history
Updating a single object wasn't detecting the title right. It
would be better to get this as a component property at some
point.

Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed Sep 23, 2019
1 parent ad6120e commit 3889c5e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class SimpleModal extends React.Component {
const { primaryKeys, formData } = this.state
let method = Axios.put
const params = {}
if (title === 'Edit') {
if (title.includes('Edit')) {
method = Axios.post
primaryKeys.map((key) => {
let actualKey = key
Expand Down
40 changes: 40 additions & 0 deletions tests/issue_25.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable max-statements, max-len */
const pauseTime = 200
const saveTime = 300
module.exports = {
'Update an existing User entry' (browser) {
// Open up the browser to the website
browser.url('http://localhost:8080')
browser.pause(pauseTime)
// Wait for the open drawer icon to show up
browser.waitForElementPresent('button[id=header-open-drawer]')
// Open the drawer
browser.click('button[id=header-open-drawer]')
browser.pause(pauseTime)
// Wait for Users to show up in the drawer
browser.waitForElementPresent('div[id=listitem-users]')
browser.getLocationInView('div[id=listitem-users]')
// Click on the Users text
browser.click('div[id=listitem-users]')
browser.pause(pauseTime)
// Wait for the close drawer icon to show up
browser.waitForElementPresent('button[id=drawer-close-drawer]')
// Close the drawer
browser.click('button[id=drawer-close-drawer]')
browser.pause(pauseTime)
// Wait for the `edit button` to show up
browser.waitForElementPresent('button[id=modal-button-edit-row-0]')
browser.click('button[id=modal-button-edit-row-0]')
browser.pause(pauseTime)
// Wait for the `middle initial` input to show up
browser.waitForElementPresent('input[id=modal-input-middle-initial]')
browser.setValue('input[id=modal-input-middle-initial]', 'something_that_does_not_exist')
browser.pause(pauseTime)
browser.click('button[id=modal-button-save]')
browser.pause(saveTime)
// Verify the member_of relationship is in the table
browser.expect.element('#root').text.to.contain('something_that_does_not_exist')
browser.pause(saveTime)
browser.end()
}
}

0 comments on commit 3889c5e

Please sign in to comment.