Fixed failing tests, and added new tests

This commit is contained in:
Henry
2017-03-26 17:02:00 -07:00
parent 529abcc4b0
commit 4e457f1cf0
13 changed files with 245 additions and 24 deletions

View File

@@ -25,6 +25,7 @@ define(
function (LayoutCompositionPolicy) {
describe("Layout's composition policy", function () {
var mockChild,
mockCandidateObj,
mockCandidate,
mockContext,
candidateType,
@@ -41,6 +42,11 @@ define(
mockContext =
jasmine.createSpyObj('contextType', ['instanceOf']);
mockCandidateObj = jasmine.createSpyObj('domainObj', [
'getCapability'
]);
mockCandidateObj.getCapability.andReturn(mockCandidate);
mockChild.getCapability.andReturn(mockContext);
mockCandidate.instanceOf.andCallFake(function (t) {
@@ -56,19 +62,19 @@ define(
it("disallows folders in layouts", function () {
candidateType = 'layout';
contextType = 'folder';
expect(policy.allow(mockCandidate, mockChild)).toBe(false);
expect(policy.allow(mockCandidateObj, mockChild)).toBe(false);
});
it("does not disallow folders elsewhere", function () {
candidateType = 'nonlayout';
contextType = 'folder';
expect(policy.allow(mockCandidate, mockChild)).toBe(true);
expect(policy.allow(mockCandidateObj, mockChild)).toBe(true);
});
it("allows things other than folders in layouts", function () {
candidateType = 'layout';
contextType = 'nonfolder';
expect(policy.allow(mockCandidate, mockChild)).toBe(true);
expect(policy.allow(mockCandidateObj, mockChild)).toBe(true);
});
});