Created
June 18, 2015 18:05
-
-
Save joeljackson/64853d54be4d3342b358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('template_renderer.directive', () => { | |
let $compile, | |
$rootScope; | |
beforeEach(angular.mock.module('beauty')); | |
beforeEach(inject((_$compile_, _$rootScope_) => { | |
$compile = _$compile_; | |
$rootScope = _$rootScope_; | |
})); | |
describe('Compilation', () => { | |
let element; | |
let template = {}; | |
beforeEach( () => { | |
let newScope = $rootScope.$new(); | |
newScope.vm = {}; | |
newScope.vm.template = template.result(); | |
element = $compile(`<div data-template-renderer data-template="vm.template">`)(newScope); | |
newScope.$digest(); | |
}); | |
describe('Template with single row', () => { | |
setVar(template, () => { | |
return { | |
current_template: { | |
rows: [ | |
{ | |
row_type: "full_width", | |
locations:{ | |
} | |
} | |
] | |
} | |
}; | |
}); | |
it("Should render out an appropriate number of smart rows", () => { | |
expect(element[0].querySelectorAll('div[data-smart-row]').length).toBe(1); | |
}); | |
}); | |
describe('Template with three rows', () => { | |
setVar( template, () => { | |
return { | |
current_template: { | |
rows: [ | |
{ | |
row_type: "full_width", | |
locations:{ | |
} | |
}, | |
{ | |
row_type: "full_width", | |
locations:{ | |
} | |
}, | |
{ | |
row_type: "full_width", | |
locations:{ | |
} | |
} | |
] | |
} | |
}; | |
}); | |
it("Should render out an appropriate number of smart rows", () => { | |
expect(element[0].querySelectorAll('div[data-smart-row]').length).toBe(3); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment