Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion src/plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import _ from 'lodash';
import $ from 'jquery';
import angular from 'angular';
import chrome from 'ui/chrome';
import 'ui/directives/kbn_top_nav';
import 'ui/courier';
import 'ui/config';
import 'ui/notify';
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/autoload/modules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'angular';
import 'ui/chrome';
import 'ui/bind';
import 'ui/kbn_top_nav';
import 'ui/bound_to_config_obj';
import 'ui/config';
import 'ui/courier';
Expand Down
2 changes: 0 additions & 2 deletions src/ui/public/chrome/directives/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'ui/directives/kbn_top_nav';

import './app_switcher';
import kbnChromeProv from './kbn_chrome';
import kbnChromeNavControlsProv from './append_nav_controls';
Expand Down
55 changes: 0 additions & 55 deletions src/ui/public/directives/__tests__/kbn_top_nav.js

This file was deleted.

128 changes: 0 additions & 128 deletions src/ui/public/directives/kbn_top_nav.js

This file was deleted.

59 changes: 59 additions & 0 deletions src/ui/public/kbn_top_nav/__tests__/kbn_top_nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import ngMock from 'ng_mock';
import expect from 'expect.js';
import { assign, pluck } from 'lodash';
import $ from 'jquery';

import '../kbn_top_nav';
import KbnTopNavControllerProvider from '../kbn_top_nav_controller';
import navbarExtensionsRegistry from 'ui/registry/navbar_extensions';
import Registry from 'ui/registry/_registry';
import 'ui/navbar_extensions';

describe('kbnTopNav directive', function () {
let build;
let KbnTopNavController;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function ($compile, $rootScope, Private) {
KbnTopNavController = Private(KbnTopNavControllerProvider);

build = function (scopeVars = {}, attrs = {}) {
const $el = $('<kbn-top-nav name="foo">').attr(attrs);
const $scope = $rootScope.$new();
assign($scope, scopeVars);
$compile($el)($scope);
$scope.$digest();
return { $el, $scope };
};
}));

it('sets the proper functions on the kbnTopNav prop on scope', function () {
const { $scope } = build();
expect($scope.kbnTopNav.open).to.be.a(Function);
expect($scope.kbnTopNav.close).to.be.a(Function);
expect($scope.kbnTopNav.is).to.be.a(Function);
expect($scope.kbnTopNav.toggle).to.be.a(Function);
});

it('allows config at nested keys', function () {
const scopeVars = {
kbn: {
top: {
nav: [
{ key: 'foo' }
]
}
}
};

const { $scope } = build(scopeVars, { config: 'kbn.top.nav' });
const optKeys = pluck($scope.kbnTopNav.opts, 'key');
expect(optKeys).to.eql(['foo']);
});

it('uses the KbnTopNavController if passed via config attribute', function () {
const controller = new KbnTopNavController();
const { $scope } = build({ controller }, { config: 'controller' });
expect($scope.kbnTopNav).to.be(controller);
});
});
Loading