Sha256: 200c2635417c49bad1b1630d7178e79cf59c54c4a1b8a26e343ce9a533181bf7
Contents?: true
Size: 1.92 KB
Versions: 14
Compression:
Stored size: 1.92 KB
Contents
describe("Rev", function() { Rev.appComponent('FunctionClass.Index', function(initialProps) { return { render: function() { return React.createElement('span', { className: 'FunctionClass' }); } } }); var reference = {render: function() {}}; beforeEach(function(){ this.componentSpec = {render: function() { return React.createElement('span'); }}; }); it("can register a new object", function() { Rev.registerObject('_registerObjectTest', reference); expect(Rev._registerObjectTest).toBe(reference); }); it("can register a new app object", function() { Rev.appObject('_appObjectTest', reference); expect(App._appObjectTest).toBe(reference); }); it("can register a new component", function() { Rev.registerComponent('_registerComponent', this.componentSpec); expect(Rev.Components._registerComponent).toBeDefined(); }); it("can register a new app component", function() { Rev.appComponent('_appComponent', this.componentSpec); expect(App.Components._appComponent).toBeDefined(); }); it("warns you if you attempt to mixin which doesn't exist", function() { spyOn(console, 'warn'); Rev.registerComponent('_nullMixinWarning', {mixins: [null], render: function() {}}); expect(console.warn).toHaveBeenCalled(); }); it("includes the core mixin", function() { Rev.registerComponent('_coreMixinFunctions', this.componentSpec); expect(this.componentSpec.mixins).toEqual([Rev.Mixins.Core]); }); it("can render a component to a string with the ujs class", function() { var result; Rev.appComponent('Ujs.Index', this.componentSpec); result = Rev.viewToString('ujs/index', '{}'); expect(result).toContain('data-react-class=\'App.Components.Main\''); }); it("can render a function component", function() { var result = Rev.viewToString('function_class/index', '{}'); expect(result).toContain('class="FunctionClass"'); }); });
Version data entries
14 entries across 12 versions & 1 rubygems