Skip to content

Instantly share code, notes, and snippets.

@alecklandgraf
Created June 27, 2016 23:34
Show Gist options
  • Select an option

  • Save alecklandgraf/c78caca874ebc086e4d454bdc6c250e5 to your computer and use it in GitHub Desktop.

Select an option

Save alecklandgraf/c78caca874ebc086e4d454bdc6c250e5 to your computer and use it in GitHub Desktop.
hello component test compile
describe("hello nav", function(){
// globals set up and used in each test scenario
var scope, element;
beforeEach(module('app'));
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
element = angular.element('<hello-nav me="me"></hello-nav>');
element = $compile(element)(scope);
scope.me = {first_name: 'Aleck', last_name: 'Landgraf'};
scope.$apply();
}));
it('should render Hello and the me.first_name and me.last_name', function () {
var divs = element.find('div');
var outer_div = divs[0];
var header = element.find('h2');
expect(outer_div.className).toBe('section-nav');
expect(header[0].text).toBe('Hello Aleck Landgraf');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment