-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide alert if user clicks an a[target="_blank"]
- Loading branch information
1 parent
8f84752
commit f1d356c
Showing
3 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import DocLink from '../../src/components/doc-link.vue'; | ||
import ProjectList from '../../src/components/project/list.vue'; | ||
|
||
import { load } from '../util/http'; | ||
import { mockLogin } from '../util/session'; | ||
import { trigger } from '../util/event'; | ||
|
||
describe('App', () => { | ||
it('hides the alert if the user clicks an a[target="_blank"]', () => { | ||
mockLogin(); | ||
const preventDefault = (event) => { | ||
event.preventDefault(); | ||
}; | ||
return load('/', { attachToDocument: true }) | ||
.then(app => { | ||
app.vm.$alert().info('Something happened!'); | ||
document.addEventListener('click', preventDefault); | ||
return trigger.click(app.first(ProjectList).first(DocLink)) | ||
.then(() => { | ||
app.should.not.alert(); | ||
}); | ||
}) | ||
.finally(() => { | ||
document.removeEventListener('click', preventDefault); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters