Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Notifiation directive. #2

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/ui/public/notify/__tests__/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ describe('Directive Notification', function () {
beforeEach(() => {
ngMock.module('kibana');
ngMock.inject(function ($rootScope, $compile) {
scope = $rootScope;
scope = $rootScope.$new();
compile = $compile;
compile;
scope;
Expand All @@ -443,10 +443,30 @@ describe('Directive Notification', function () {

afterEach(() => {
directiveNotification.clear();
scope.$destroy();
});

it('renders the directive template', () => {
// do something cool here
describe('returns a renderable notification', () => {
let element;

beforeEach(() => {
scope.notif = notifier.directive(directiveParam, customParams);
const template = `
<render-directive
definition="notif.directive"
notif="notif"
></render-directive>`;
element = compile(template)(scope);
scope.$apply();
});

it('that renders with the provided template', () => {
expect(element.find('h1').text()).to.contain('Hello world');
});

it('that renders with the provided controller', () => {
expect(element.text()).to.contain('🎉');
});
});

it('throws if first param is not an object', () => {
Expand Down