版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const $ = require('../index');
  2. const config = require('./config');
  3. const jc1 = require('./code/simple1');
  4. const jc2 = require('./code/simple2');
  5. const hc1 = require('./code/simple1.html');
  6. test('$.root: simple code', () => {
  7. expect(()=>{
  8. const G = $('var a = 1;');
  9. G.root();
  10. }).not.toThrow();
  11. })
  12. test('$.root: simple code remove node', () => {
  13. expect(()=>{
  14. const G = $('var a = 1;');
  15. G[0] = null
  16. G.root();
  17. }).not.toThrow();
  18. })
  19. test('$.root: simple1 code', () => {
  20. expect(()=>{
  21. const G = $(jc1);
  22. G.root();
  23. }).not.toThrow();
  24. })
  25. test('$.root: simple1 code result should be ok', () => {
  26. const G = $(jc1);
  27. const code = G.root().generate();
  28. expect(code.indexOf('const h = height();') > -1).toBeTruthy();
  29. })
  30. test('$.root: simple2 code result should be ok', () => {
  31. const G = $(jc2);
  32. const code = G.root().generate();
  33. expect(code.indexOf(`this.observeLocation(['start', 'end'])`) > -1).toBeTruthy();
  34. })
  35. test('$.root: simple2 code result should be ok', () => {
  36. const G = $(jc2);
  37. const code = G.find('View.extend($_$)').root().generate();
  38. expect(code.indexOf(`this.observeLocation(['start', 'end'])`) > -1).toBeTruthy();
  39. })
  40. test('$.root: simple1 html code', () => {
  41. expect(() => {
  42. const G = $(hc1, config.html);
  43. G.root();
  44. }).not.toThrow();
  45. })
  46. test('$.root: simple1 html code result should be ok', () => {
  47. expect(() => {
  48. const G = $(hc1, config.html);
  49. G.root();
  50. }).not.toThrow();
  51. })
  52. test('$.root: simple1 html code result should be ok', () => {
  53. const G = $(hc1, config.html);
  54. const code = G.root().generate();
  55. expect(code.indexOf('<html>') > -1).toBeTruthy();
  56. })
  57. test('$.root: simple1 html code result should be ok', () => {
  58. const G = $(hc1, config.html);
  59. const code = G.find('<title>title</title>').root().generate();
  60. expect(code.indexOf('<html>') > -1).toBeTruthy();
  61. })