File tree 2 files changed +0
-56
lines changed
src/isomorphic/classic/class 2 files changed +0
-56
lines changed Original file line number Diff line number Diff line change @@ -704,23 +704,6 @@ function bindAutoBindMethods(component) {
704
704
}
705
705
}
706
706
707
- var typeDeprecationDescriptor = {
708
- enumerable : false ,
709
- get : function ( ) {
710
- var displayName = this . displayName || this . name || 'Component' ;
711
- warning (
712
- false ,
713
- '%s.type is deprecated. Use %s directly to access the class.' ,
714
- displayName ,
715
- displayName
716
- ) ;
717
- Object . defineProperty ( this , 'type' , {
718
- value : this
719
- } ) ;
720
- return this ;
721
- }
722
- } ;
723
-
724
707
/**
725
708
* Add more to the ReactClass base class. These are all legacy features and
726
709
* therefore not already part of the modern ReactComponent.
@@ -915,16 +898,6 @@ var ReactClass = {
915
898
}
916
899
}
917
900
918
- // Legacy hook
919
- Constructor . type = Constructor ;
920
- if ( __DEV__ ) {
921
- try {
922
- Object . defineProperty ( Constructor , 'type' , typeDeprecationDescriptor ) ;
923
- } catch ( x ) {
924
- // IE will fail on defineProperty (es5-shim/sham too)
925
- }
926
- }
927
-
928
901
return Constructor ;
929
902
} ,
930
903
Original file line number Diff line number Diff line change @@ -44,35 +44,6 @@ describe('ReactClass-spec', function() {
44
44
. toBe ( 'TestComponent' ) ;
45
45
} ) ;
46
46
47
- it ( 'should warn when accessing .type on a React class' , function ( ) {
48
- var TestComponent = React . createClass ( {
49
- render : function ( ) {
50
- return < div /> ;
51
- }
52
- } ) ;
53
- var SecondTestComponent = React . createClass ( {
54
- render : function ( ) {
55
- return < div /> ;
56
- }
57
- } ) ;
58
- expect ( TestComponent . type ) . toBe ( TestComponent ) ;
59
- expect ( console . error . argsForCall . length ) . toBe ( 1 ) ;
60
- expect ( console . error . argsForCall [ 0 ] [ 0 ] ) . toBe (
61
- 'Warning: TestComponent.type is deprecated. Use TestComponent ' +
62
- 'directly to access the class.'
63
- ) ;
64
- // Warn once per class
65
- expect ( SecondTestComponent . type ) . toBe ( SecondTestComponent ) ;
66
- expect ( console . error . argsForCall . length ) . toBe ( 2 ) ;
67
- expect ( console . error . argsForCall [ 1 ] [ 0 ] ) . toBe (
68
- 'Warning: SecondTestComponent.type is deprecated. Use ' +
69
- 'SecondTestComponent directly to access the class.'
70
- ) ;
71
- // Not again
72
- expect ( TestComponent . type ) . toBe ( TestComponent ) ;
73
- expect ( console . error . argsForCall . length ) . toBe ( 2 ) ;
74
- } ) ;
75
-
76
47
it ( 'should copy prop types onto the Constructor' , function ( ) {
77
48
var propValidator = mocks . getMockFunction ( ) ;
78
49
var TestComponent = React . createClass ( {
You can’t perform that action at this time.
0 commit comments