Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. import { newSpecPage } from '@stencil/core/testing';
  2.  
  3. import { MyComplexPropComponent } from './complex-prop';
  4.  
  5. describe('complex prop', () => {
  6.  
  7. it ('should change to upper case', () => {
  8. let cmp = new MyComplexPropComponent();
  9. let res = cmp.toUpper(['aaa', 'bbb', 'ccc']);
  10. expect(res).toEqual(['AAA', 'BBB', 'CCC']);
  11. });
  12.  
  13. it('should render', async () => {
  14. const page = await newSpecPage({
  15. components: [MyComplexPropComponent],
  16. html: `
  17. <my-complex-prop>
  18. </my-complex-prop>
  19. `
  20. });
  21. page.rootInstance.values = ['aaa', 'bbb', 'ccc'];
  22. await page.waitForChanges();
  23. expect(page.root).toMatchSnapshot();
  24. });
  25. it('should render with data', async () => {
  26. const page = await newSpecPage({
  27. components: [MyComplexPropComponent],
  28. html: '<div></div>'
  29. });
  30. let cmp = page.doc.createElement('my-complex-prop');
  31. (cmp as any).values = ['aaa', 'bbb', 'ccc'];
  32. page.root.appendChild(cmp);
  33. await page.waitForChanges();
  34. expect(page.root).toMatchSnapshot();
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement