Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. /* eslint-env node, mocha */
  2. /* global expect */
  3. /* eslint no-console: 0 */
  4. 'use strict';
  5.  
  6. // Uncomment the following lines to use the react test utilities
  7. import React from 'react';
  8. import {mount} from 'enzyme';
  9. import {observable} from 'mobx';
  10. import {observer} from 'mobx-react';
  11.  
  12. @observer
  13. class Observer extends React.Component {
  14. render() {
  15. this.props.fields[this.props.name].indexOf('');
  16. return false;
  17. }
  18. }
  19.  
  20. describe.only('Function push ref', () => {
  21. const fields = observable({
  22. colors: []
  23. });
  24.  
  25. const realpush = fields.colors.push;
  26. console.log(`actual push: ${realpush.toString()}`);
  27.  
  28. mount(
  29. <span>
  30. <Observer fields={fields} name='colors'/>
  31. <Observer fields={fields} name='colors'/>
  32. </span>
  33. );
  34.  
  35. it('should not change push prototype.', ()=>{
  36. let push = fields.colors.push.toString();
  37. console.log(`current push: ${push}`)
  38. expect(push).to.not.contain('predicate');
  39. });
  40. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement