react / react-0.13.3 / examples / basic-commonjs / node_modules / reactify / node_modules / react-tools / src / core / __tests__ / ReactCompositeComponentSpec-test.js
81155 views/**1* Copyright 2013-2014, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @emails react-core9*/1011"use strict";1213var mocks = require('mocks');1415var React;16var ReactTestUtils;17var reactComponentExpect;1819describe('ReactCompositeComponent-spec', function() {2021beforeEach(function() {22React = require('React');23ReactTestUtils = require('ReactTestUtils');24reactComponentExpect = require('reactComponentExpect');25});2627it('should throw when `render` is not specified', function() {28expect(function() {29React.createClass({});30}).toThrow(31'Invariant Violation: createClass(...): Class specification must ' +32'implement a `render` method.'33);34});3536it('should copy `displayName` onto the Constructor', function() {37var TestComponent = React.createClass({38render: function() {39return <div />;40}41});4243expect(TestComponent.type.displayName)44.toBe('TestComponent');45});4647it('should copy prop types onto the Constructor', function() {48var propValidator = mocks.getMockFunction();49var TestComponent = React.createClass({50propTypes: {51value: propValidator52},53render: function() {54return <div />;55}56});5758expect(TestComponent.type.propTypes).toBeDefined();59expect(TestComponent.type.propTypes.value)60.toBe(propValidator);61});62});636465