afterEach(function () {
   MesosSummaryStore.removeAllListeners();
   ReactDOM.unmountComponentAtNode(this.container);
 });
	componentWillUnmount() {
		document.removeEventListener('click',this.hideTarget)
		if(this.wrap){
			ReactDOM.unmountComponentAtNode(this.wrap)
		}
	}
it('renders without crashing', () => {
  const div = document.createElement('div');
  ReactDOM.render(<Animation />, div);
  ReactDOM.unmountComponentAtNode(div);
});
    this.server.respondWith('POST', ENV.GRADING_STANDARDS_URL, [
      200,
      {'Content-Type': 'application/json'},
      JSON.stringify(this.createdStandard)
    ])
    this.server.respondWith('PUT', `${ENV.GRADING_STANDARDS_URL}/1`, [
      200,
      {'Content-Type': 'application/json'},
      JSON.stringify(this.updatedStandard)
    ])
    const GradingStandardCollectionElement = <GradingStandardCollection />
    this.gradingStandardCollection = TestUtils.renderIntoDocument(GradingStandardCollectionElement)
    return this.server.respond()
  },
  teardown() {
    ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this.gradingStandardCollection).parentNode)
    ENV.current_user_roles = null
    ENV.GRADING_STANDARDS_URL = null
    ENV.DEFAULT_GRADING_STANDARD_DATA = null
    return this.server.restore()
  }
})

test('gets the standards data from the grading standards controller, and multiplies data values by 100 (i.e. .20 becomes 20)', function() {
  deepEqual(this.gradingStandardCollection.state.standards, this.processedIndexData)
})

test('getStandardById gets the correct standard by its id', function() {
  deepEqual(this.gradingStandardCollection.getStandardById(1), _.first(this.processedIndexData))
})
Exemple #5
0
it("ArticleCard component renders without crashing", () => {
  const div = document.createElement("div");
  ReactDOM.render(<ArticleCard />, div);
  ReactDOM.unmountComponentAtNode(div);
});
 afterEach(function () {
   ReactDOM.unmountComponentAtNode(this.container);
 });
function unmount(el) {
  const domNodeId = el.getAttribute('data-dom-id');
  const domNode = document.getElementById(domNodeId);
  ReactDOM.unmountComponentAtNode(domNode);
}
 unMountNode() {
     unmountComponentAtNode(this.container);
 }
test('display none if no props supplied', () => {
  const loadingIndicator = React.createFactory(LoadingIndicator)
  const rendered = TestUtils.renderIntoDocument(loadingIndicator())
  equal($(rendered.getDOMNode()).css('display'), 'none', 'loading indicator not shown')
  ReactDOM.unmountComponentAtNode(rendered.getDOMNode().parentNode)
})
jQuery.entwine('ss', ($) => {
  $('.insert-link__dialog-wrapper').entwine({
    Element: null,

    Data: {},

    onunmatch() {
      // solves errors given by ReactDOM "no matched root found" error.
      this._clearModal();
    },

    _clearModal() {
      ReactDOM.unmountComponentAtNode(this[0]);
      // this.empty();
    },

    open() {
      this.renderModal(true);
    },

    close() {
      this.setData({});
      this.renderModal(false);
    },

    renderModal() {
      /* noop */
    },

    /**
     * Default behaviour, recommended to overload this and sanitise where needed
     *
     * @param data
     * @private
     */
    handleInsert(data) {
      const attributes = this.buildAttributes(data);

      this.insertLinkInEditor(attributes);
      this.close();

      return Promise.resolve();
    },

    buildAttributes(data) {
      const anchor = data.Anchor && data.Anchor.length ? `#${data.Anchor}` : '';
      const href = `${data.Link}${anchor}`;

      return {
        href,
        target: data.TargetBlank ? '_blank' : '',
        title: data.Description,
      };
    },

    insertLinkInEditor(attributes) {
      const editor = this.getElement().getEditor();
      editor.insertLink(attributes);
      editor.addUndo();
      editor.repaint();
    },

    getOriginalAttributes() {
      const editor = this.getElement().getEditor();
      const node = $(editor.getSelectedNode());

      const hrefParts = (node.attr('href') || '').split('#');

      return {
        Link: hrefParts[0] || '',
        Anchor: hrefParts[1] || '',
        Description: node.attr('title'),
        TargetBlank: !!node.attr('target'),
      };
    },
  });
});
 afterEach(function bafterEachPropTypesElementOfType() {
   consoleErrorSpy.restore();
   unmountComponentAtNode(domEl);
   domEl = null;
 });
 courseModal: function() {
   ReactDOM.unmountComponentAtNode($('#modal-container')[0]);
   ReactDOM.render(<CourseModalComponent terms={this.props.terms} collection={this.props.collection} model={this.props.model}/>, $('#modal-container')[0]);
   $('#course-modal' + this.props.model.id).openModal();
   Materialize.updateTextFields();
 },
Exemple #13
0
exports.unmount = function () {
  return ReactDOM.unmountComponentAtNode(div);
};
 afterEach(function () {
   RequestUtil.json = this.requestFn;
   ReactDOM.unmountComponentAtNode(this.container);
 });
Exemple #15
0
 componentWillUnmount () {
   ReactDOM.unmountComponentAtNode(this._mountNode);
   this._mountNode = null;
 }
test('if props supplied for loading', () => {
  const loadingIndicator = React.createFactory(LoadingIndicator)
  const rendered = TestUtils.renderIntoDocument(loadingIndicator({isLoading: true}))
  equal($(rendered.getDOMNode()).css('display'), '', 'loading indicator is shown')
  ReactDOM.unmountComponentAtNode(rendered.getDOMNode().parentNode)
})
Exemple #17
0
 setTimeout(() => {
   ReactDOM.unmountComponentAtNode(MOUNT_NODE)
   render()
 })
      validDropdownOptions: [],
      currentlySearching: false,
      allStudentsFetched: true,
      handleDelete() {},
      defaultSectionNamer() {},
      handleTokenAdd() {},
      handleTokenRemove() {},
      replaceDate() {},
      inputsDisabled: false
    }
    const DueDateRowElement = <DueDateRow {...props} />
    this.dueDateRow = ReactDOM.render(DueDateRowElement, $('<div>').appendTo('body')[0])
  },
  teardown() {
    fakeENV.teardown()
    ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this.dueDateRow).parentNode)
  }
})

test('renders', function() {
  ok(this.dueDateRow)
})

test('returns a remove link if canDelete', function() {
  ok(this.dueDateRow.removeLinkIfNeeded())
})

QUnit.module('DueDateRow with realistic props and canDelete false', {
  setup() {
    fakeENV.setup()
    ENV.context_asset_string = 'course_1'
 setTimeout(() => {
   ReactDOM.unmountComponentAtNode(wrapper);
   setTimeout(() => wrapper.remove());
 }, 1000);
Exemple #20
0
 return () => {
   unmountComponentAtNode(domElement);
 };
Exemple #21
0
 static close() {
   var container = document.getElementById('dialog-container');
   if (!container) return;
   ReactDOM.unmountComponentAtNode(container);
   document.body.removeChild(container);
 }
Exemple #22
0
 $scope.$on('$destroy', () => {
   stopListeningForLocationChange();
   unmountComponentAtNode(appElement);
 });
Exemple #23
0
export function __unload() {
    window.__UNISTACK__.initialRender = true
    window.__UNISTACK__.state = store.getState()
    ReactDOM.unmountComponentAtNode(container)
}
Exemple #24
0
 unmount () {
   ReactDOM.unmountComponentAtNode(this.root);
 }
Exemple #25
0
 unmount(){
   ReactDOM.unmountComponentAtNode(document.getElementById('a'))
 }
Exemple #26
0
 afterEach(() => {
   ReactDOM.unmountComponentAtNode(div);
   document.body.removeChild(div);
 });
		setTimeout(()=>{
			if (!self.innerClick && this.wrap) {
				ReactDOM.unmountComponentAtNode(this.wrap)
			}
			self.innerClick = false
		}, 50)
 close: function () {
     ReactDOM.unmountComponentAtNode(dom);
 }
      shortName: 'Bio 101',
      originalName: 'Biology',
      assetString: 'foo',
      href: '/courses/1',
      courseCode: '101',
      id: '1',
      backgroundColor: '#EF4437',
      image: null,
      connectDragSource: c => c,
      connectDropTarget: c => c
    }
    return sandbox.stub(CourseActivitySummaryStore, 'getStateForCourse').returns({})
  },
  teardown() {
    localStorage.clear()
    ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this.component).parentNode)
    if (this.wrapper) {
      return this.wrapper.remove()
    }
  }
})

test('render', function() {
  const DashCard = <DashboardCard {...this.props} />
  this.component = TestUtils.renderIntoDocument(DashCard)
  const $html = $(ReactDOM.findDOMNode(this.component))
  ok($html.attr('class').match(/DashboardCard/))
  const renderSpy = sandbox.spy(this.component, 'render')
  ok(!renderSpy.called, 'precondition')
  CourseActivitySummaryStore.setState({streams: {1: {stream: this.stream}}})
  ok(renderSpy.called, 'should re-render on state update')
Exemple #30
0
 afterEach(() => {
   ReactDOM.unmountComponentAtNode(node);
 });