origin-add.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. var t = require('assert')
  2. var defaults = require('./utils/defaults')
  3. module.exports = ({popup, advanced, content}) => {
  4. before(async () => {
  5. await defaults({popup, advanced, content})
  6. })
  7. describe('defaults', () => {
  8. it('localhost:3000', async () => {
  9. t.equal(
  10. await advanced.evaluate(() =>
  11. document.querySelectorAll('.m-list li').length
  12. ),
  13. 2,
  14. 'allowed origins count should be 2'
  15. )
  16. t.equal(
  17. await advanced.evaluate(() =>
  18. document.querySelector('.m-list li:nth-of-type(2) .m-origin').innerText
  19. ),
  20. 'http://localhost:3000',
  21. 'origin name should be http://localhost:3000'
  22. )
  23. t.strictEqual(
  24. await advanced.evaluate(() =>
  25. document.querySelector('.m-list li:nth-of-type(2) .m-switch').classList.contains('is-checked')
  26. ),
  27. false,
  28. 'csp checkbox should be disabled'
  29. )
  30. t.equal(
  31. await advanced.evaluate(() =>
  32. document.querySelector('.m-list li:nth-of-type(2) .m-encoding select').value
  33. ),
  34. '',
  35. 'encoding should be set to auto'
  36. )
  37. t.strictEqual(
  38. await advanced.evaluate(() =>
  39. document.querySelectorAll('.m-list li:nth-of-type(2) .m-footer .m-button').length
  40. ),
  41. 1,
  42. 'only one button should be visible in the origin footer'
  43. )
  44. t.equal(
  45. await advanced.evaluate(() =>
  46. document.querySelector('.m-list li:nth-of-type(2) .m-footer .m-button').innerText.toLowerCase()
  47. ),
  48. 'remove',
  49. 'remove origin button should be rendered'
  50. )
  51. })
  52. })
  53. }