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

35 строки
1.1 KiB

  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('$.isHtml: simple code should not throw error', () => {
  7. expect(() => {
  8. const G = $('var a = 1;');
  9. G.isHtml;
  10. }).not.toThrow();
  11. })
  12. test('$.isHtml: simple2 js code, isHtml should not be truthy', () => {
  13. const G = $(jc2).find('View.extend($_$)');
  14. expect(G.isHtml).not.toBeTruthy();
  15. })
  16. test('$.isHtml: isHtml should be true ', () => {
  17. const G = $(hc1, config.html);
  18. expect(G.isHtml).toBeTruthy();
  19. })
  20. test('$.isHtml: simple html code should not throw error', () => {
  21. expect(() => {
  22. const G = $(hc1, config.html);
  23. G.isHtml;
  24. }).not.toThrow();
  25. })
  26. test('$.isHtml: simple1 html code result should be ok', () => {
  27. const G = $(hc1, config.html).find('<span>$_$</span>');
  28. expect(G.isHtml).toBeTruthy();
  29. })
  30. test('$.isHtml: isHtml should be false ', () => {
  31. const G = $('var a = 1;');
  32. expect(G.isHtml).not.toBeTruthy();
  33. })