Sha256: a205df2d16ec55755c590ccbf230ba6845278bd5dbae00c90083e7d976fb42e2

Contents?: true

Size: 1.88 KB

Versions: 8

Compression:

Stored size: 1.88 KB

Contents

describe(rio.Component, {
	"inheritance": {
		beforeEach: function() {
			var SuperComponent = rio.Component.create("SuperComponent", {
				attrAccessors: ["a"],
				attrHtmls: ["super"],
				methods: { 
					buildSuperHtml: function() { return "foo"; },
					superHello: function() { return "super world"; }
				}
			});
			var SubComponent = rio.Component.create(SuperComponent, "SubComponent", {
				attrAccessors: ["b"],
				attrHtmls: ["sub"],
				methods: { 
					buildSubHtml: function() { return "bar"; },
					subHello: function() { return "sub world"; }
				}
			});
			var SubSubComponent = rio.Component.create(SubComponent, "SubSubComponent", {
				attrAccessors: ["c"],
				attrHtmls: ["subSub"],
				methods: { 
					buildSubSubHtml: function() { return "baz"; },
					subSubHello: function() { return "sub sub world"; }
				}
			});
			
			this.component = new SubSubComponent({ a: 1, b: 2, c: 3 });
		},
		
		"should support attrHtmls": function() {
			this.component.subSubHtml().shouldEqual("baz");
		},

		"should inherit parent's attrHtmls": function() {
			this.component.subHtml().shouldEqual("bar");
		},

		"should inherit grandparent's attrHtmls": function() {
			this.component.superHtml().shouldEqual("foo");
		},
		
		"should support attrAccessors": function() {
			this.component.getC().shouldEqual(3);
		},
		
		"should inherit parent's attrAccessors": function() {
			this.component.getB().shouldEqual(2);
		},
		
		"should inherit grandparent's attrAccessors": function() {
			this.component.getA().shouldEqual(1);
		},
		
		"should support methods": function() {
			this.component.subSubHello().shouldEqual("sub sub world");
		},
		
		"should inherit parent's methods": function() {
			this.component.subHello().shouldEqual("sub world");
		},
		
		"should inherit grandparent's methods": function() {
			this.component.superHello().shouldEqual("super world");
		}
	}
});


















Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
riojs-0.0.7 public/javascripts/specs/lib/component_spec.js
riojs-0.0.6 public/javascripts/specs/lib/component_spec.js
riojs-0.0.5 public/javascripts/specs/lib/component_spec.js
riojs-0.0.4 public/javascripts/specs/lib/component_spec.js
riojs-0.0.3 public/javascripts/specs/lib/component_spec.js
riojs-0.0.2 public/javascripts/specs/lib/component_spec.js
riojs-0.0.1 public/javascripts/specs/lib/component_spec.js
riojs-0.0.0 public/javascripts/specs/lib/component_spec.js