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 @@ -476,6 +476,25 @@ def render
476
476
end
477
477
end
478
478
479
+ describe 'Anonymous Component' do
480
+ it "will not generate spurious warning messages" do
481
+ foo = Class . new ( React ::Component ::Base )
482
+ foo . class_eval do
483
+ def render ; "hello" end
484
+ end
485
+
486
+ %x{
487
+ var log = [];
488
+ var org_warn_console = window.console.warn;
489
+ var org_error_console = window.console.error
490
+ window.console.warn = window.console.error = function(str){log.push(str)}
491
+ }
492
+ renderToDocument ( foo )
493
+ `window.console.warn = org_warn_console; window.console.error = org_error_console;`
494
+ expect ( `log` ) . to eq ( [ ] )
495
+ end
496
+ end
497
+
479
498
describe 'Event handling' do
480
499
before do
481
500
stub_const 'Foo' , Class . new
You can’t perform that action at this time.
0 commit comments