This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ def prop_types
43
43
_componentValidator : %x{
44
44
function(props, propName, componentName) {
45
45
var errors = #{ validator . validate ( Hash . new ( `props` ) ) } ;
46
- var error = new Error(#{ "In component `" + self . name + " `\n " + `errors` . join ( "\n " ) } );
46
+ var error = new Error(#{ "In component `#{ name } `\n " + `errors` . join ( "\n " ) } );
47
47
return #{ `errors` . count > 0 ? `error` : `undefined` } ;
48
48
}
49
49
}
Original file line number Diff line number Diff line change @@ -477,6 +477,25 @@ def render
477
477
end
478
478
end
479
479
480
+ describe 'Anonymous Component' do
481
+ it "will not generate spurious warning messages" do
482
+ foo = Class . new ( React ::Component ::Base )
483
+ foo . class_eval do
484
+ def render ; "hello" end
485
+ end
486
+
487
+ %x{
488
+ var log = [];
489
+ var org_warn_console = window.console.warn;
490
+ var org_error_console = window.console.error
491
+ window.console.warn = window.console.error = function(str){log.push(str)}
492
+ }
493
+ renderToDocument ( foo )
494
+ `window.console.warn = org_warn_console; window.console.error = org_error_console;`
495
+ expect ( `log` ) . to eq ( [ ] )
496
+ end
497
+ end
498
+
480
499
describe 'Event handling' do
481
500
before do
482
501
stub_const 'Foo' , Class . new
You can’t perform that action at this time.
0 commit comments