Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

acceptance.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. var request = require('supertest');
  2. var path = require('path');
  3. var liveServer = require('..').start({
  4. root: path.join(__dirname, "data"),
  5. port: 0,
  6. open: false
  7. });
  8. describe('basic functional tests', function(){
  9. it('should respond with index.html', function(done){
  10. request(liveServer)
  11. .get('/')
  12. .expect('Content-Type', 'text/html; charset=UTF-8')
  13. .expect(/hello world/i)
  14. .expect(200, done);
  15. });
  16. it('should have injected script', function(done){
  17. request(liveServer)
  18. .get('/')
  19. .expect('Content-Type', 'text/html; charset=UTF-8')
  20. .expect(/<script [^]+?live reload enabled[^]+?<\/script>/i)
  21. .expect(200, done);
  22. });
  23. it('should inject script when tags are in CAPS', function(done){
  24. request(liveServer)
  25. .get('/index-caps.htm')
  26. .expect('Content-Type', 'text/html; charset=UTF-8')
  27. .expect(/<script [^]+?live reload enabled[^]+?<\/script>/i)
  28. .expect(200, done);
  29. });
  30. it('should inject to <head> when no <body>', function(done){
  31. request(liveServer)
  32. .get('/index-head.html')
  33. .expect('Content-Type', 'text/html; charset=UTF-8')
  34. .expect(/<script [^]+?live reload enabled[^]+?<\/script>/i)
  35. .expect(200, done);
  36. });
  37. it('should inject also svg files', function(done){
  38. request(liveServer)
  39. .get('/test.svg')
  40. .expect('Content-Type', 'image/svg+xml')
  41. .expect(function(res) {
  42. if (res.body.toString().indexOf("Live reload enabled") == -1)
  43. throw new Error("injected code not found");
  44. })
  45. .expect(200, done);
  46. });
  47. it('should not inject html fragments', function(done){
  48. request(liveServer)
  49. .get('/fragment.html')
  50. .expect('Content-Type', 'text/html; charset=UTF-8')
  51. .expect(function(res) {
  52. if (res.text.toString().indexOf("Live reload enabled") > -1)
  53. throw new Error("injected code should not be found");
  54. })
  55. .expect(200, done);
  56. });
  57. xit('should have WebSocket connection', function(done){
  58. done(); // todo
  59. });
  60. xit('should reload on page change', function(done){
  61. done(); // todo
  62. });
  63. xit('should reload (without refreshing) on css change', function(done){
  64. done(); // todo
  65. });
  66. });