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

Version Path
revelry_core-0.1.24.0 spec/javascripts/core_spec.js
revelry_core-0.1.23.0 spec/javascripts/core_spec.js
revelry_core-0.1.22.0 spec/javascripts/core_spec.js
revelry_core-0.1.21.0 spec/javascripts/core_spec.js
revelry_core-0.1.20.0 spec/javascripts/core_spec.js
revelry_core-0.1.19.0 spec/javascripts/core_spec.js
revelry_core-0.1.18.0 spec/javascripts/core_spec.js
revelry_core-0.1.17.0 spec/javascripts/core_spec.js
revelry_core-0.1.16.0 spec/javascripts/core_spec.js
revelry_core-0.1.15.0 spec/javascripts/core_spec.js
revelry_core-0.1.14.0 spec/javascripts/core_spec.js
revelry_core-0.1.14.0 spec/dummy/tmp/jasmine/assets/core_spec.self.js
revelry_core-0.1.13.0 spec/dummy/tmp/jasmine/assets/core_spec.self.js
revelry_core-0.1.13.0 spec/javascripts/core_spec.js