Permalink
Browse files

fix regression in handling of repeated local invoke

Fixes #1063
  • Loading branch information...
starpit committed Jul 30, 2018
1 parent 621bdef commit f313120a2647df96b60544cf941ac4644774ee5d
Showing with 17 additions and 7 deletions.
  1. +6 −0 app/content/js/ui.js
  2. +11 −7 tests/tests/passes/04/local.js
@@ -1796,17 +1796,23 @@ const ui = (function() {
const id = `injected-${type}-${url}`
if (!document.getElementById(id)) {
// we haven't yet injected the script
var link = document.createElement('script')
link.id = id
link.src = url
link.async = true
link.addEventListener('load', () => {
debug('injected script', url, id, link)
// done!
resolve()
})
document.getElementsByTagName('head')[0].appendChild(link);
} else {
// otherwise, we've already injected the script
resolve()
}
})
@@ -49,13 +49,17 @@ describe('local plugin', function() {
.then(sidecar.expectShowing('foo'))
.catch(common.oops(this)))
it('should invoke that action locally', () => cli.do('local invoke foo -p name smurf', this.app)
.then(cli.expectOK)
.then(sidecar.expectOpen)
.then(sidecar.expectShowing('foo', 'local activation'))
.then(() => this.app.client.getText(ui.selectors.SIDECAR_ACTIVATION_RESULT))
.then(ui.expectStruct({name:"smurf"}))
.catch(common.oops(this)))
// perform more than one invoke; see #1063, which had a test gap
// due to the lack of repeated local invoke
for (let idx = 0; idx < 3; idx++) {
it('should invoke that action locally', () => cli.do('local invoke foo -p name smurf', this.app)
.then(cli.expectOK)
.then(sidecar.expectOpen)
.then(sidecar.expectShowing('foo', 'local activation'))
.then(() => this.app.client.getText(ui.selectors.SIDECAR_ACTIVATION_RESULT))
.then(ui.expectStruct({name:"smurf"}))
.catch(common.oops(this)))
}
it('should switch to logs mode and observe our log entry', () => cli.do('logs', this.app)
.then(cli.expectJustOK)

0 comments on commit f313120

Please sign in to comment.