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
4343 _componentValidator : %x{
4444 function(props, propName, componentName) {
4545 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 " ) } );
4747 return #{ `errors` . count > 0 ? `error` : `undefined` } ;
4848 }
4949 }
Original file line number Diff line number Diff line change @@ -476,6 +476,25 @@ def render
476476 end
477477 end
478478
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+
479498 describe 'Event handling' do
480499 before do
481500 stub_const 'Foo' , Class . new
You can’t perform that action at this time.
0 commit comments