Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
8fc14348d7
|
@ -12,7 +12,7 @@ describe('Component vnDropDown', () => {
|
||||||
|
|
||||||
beforeEach(angular.mock.inject((_$componentController_, _$timeout_, _$filter_) => {
|
beforeEach(angular.mock.inject((_$componentController_, _$timeout_, _$filter_) => {
|
||||||
$componentController = _$componentController_;
|
$componentController = _$componentController_;
|
||||||
$element = angular.element('<div></div>');
|
$element = angular.element('<div><ul><li></li></ul></div>');
|
||||||
$timeout = _$timeout_;
|
$timeout = _$timeout_;
|
||||||
$filter = _$filter_;
|
$filter = _$filter_;
|
||||||
}));
|
}));
|
||||||
|
@ -268,7 +268,7 @@ describe('Component vnDropDown', () => {
|
||||||
expect(controller._activeOption).toEqual(0);
|
expect(controller._activeOption).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should call clearSearch() Esc key is pressed and take off 1 from _activeOption`, () => {
|
it(`should call clearSearch() Esc key is pressed and add up 1 to _activeOption`, () => {
|
||||||
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}];
|
controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}];
|
||||||
spyOn(controller, 'setScrollPosition');
|
spyOn(controller, 'setScrollPosition');
|
||||||
|
@ -284,4 +284,77 @@ describe('Component vnDropDown', () => {
|
||||||
expect(controller._activeOption).toEqual(2);
|
expect(controller._activeOption).toEqual(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('setScrollPosition()', () => {
|
||||||
|
it(`should call child.scrollIntoView if defined `, () => {
|
||||||
|
$element[0].firstChild.setAttribute('class', 'dropdown');
|
||||||
|
let child = $element[0].firstChild.firstChild;
|
||||||
|
child.scrollIntoView = () => {};
|
||||||
|
spyOn(child, 'scrollIntoView');
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
|
controller._activeOption = 0;
|
||||||
|
controller.setScrollPosition();
|
||||||
|
|
||||||
|
expect(child.scrollIntoView).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('selectItem()', () => {
|
||||||
|
it(`should pass item to selected and set controller._show to false`, () => {
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
|
let item = {id: 1, name: 'Batman'};
|
||||||
|
controller.selectItem(item);
|
||||||
|
|
||||||
|
expect(controller.selected).toEqual(item);
|
||||||
|
expect(controller._show).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should pass item to selected and set controller._show to true if the controller.multiple is defined`, () => {
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
|
let item = {id: 1, name: 'Batman'};
|
||||||
|
controller.multiple = true;
|
||||||
|
controller.selectItem(item);
|
||||||
|
|
||||||
|
expect(controller.selected).toEqual(item);
|
||||||
|
expect(controller._show).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('loadItems()', () => {
|
||||||
|
it(`should set controller._show to true`, () => {
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
|
controller.loadItems();
|
||||||
|
|
||||||
|
expect(controller._show).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should call loadMore() and then set controller._show to true`, () => {
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter}, {showLoadMore: () => {}, loadMore: () => {}});
|
||||||
|
spyOn(controller, 'loadMore');
|
||||||
|
controller.loadItems();
|
||||||
|
|
||||||
|
expect(controller._show).toEqual(true);
|
||||||
|
expect(controller.loadMore).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('$onInit()', () => {
|
||||||
|
it(`should add an event listener to the parent element`, () => {
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
|
spyOn(controller.parent, 'addEventListener');
|
||||||
|
controller.$onInit();
|
||||||
|
|
||||||
|
expect(controller.parent.addEventListener).toHaveBeenCalledWith('keydown', jasmine.any(Function));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('$onDestroy()', () => {
|
||||||
|
it(`should remove an event listener from the parent element`, () => {
|
||||||
|
let controller = $componentController('vnDropDown', {$element, $timeout, $filter});
|
||||||
|
spyOn(controller.parent, 'removeEventListener');
|
||||||
|
controller.$onDestroy();
|
||||||
|
|
||||||
|
expect(controller.parent.removeEventListener).toHaveBeenCalledWith('keydown', jasmine.any(Function));
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import './grid-header.js';
|
||||||
|
|
||||||
|
describe('Component vnGridHeader', () => {
|
||||||
|
let $componentController;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
angular.mock.module('client');
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject(_$componentController_ => {
|
||||||
|
$componentController = _$componentController_;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('selectColum()', () => {
|
||||||
|
it(`should set controller currentColumn to equal the argument received`, () => {
|
||||||
|
let controller = $componentController('vnGridHeader', {});
|
||||||
|
let col = {columnStuff: 'some stuff'};
|
||||||
|
controller.selectColum(col);
|
||||||
|
|
||||||
|
expect(controller.currentColumn).toEqual(col);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should set controller currentColumn.order to undefined then set currentColumn to equal the argument received`, () => {
|
||||||
|
let controller = $componentController('vnGridHeader', {});
|
||||||
|
controller.currentColumn = {field: 'some field', order: 'ordered'};
|
||||||
|
let col = {columnStuff: 'some stuff'};
|
||||||
|
controller.selectColum(col);
|
||||||
|
|
||||||
|
expect(controller.currentColumn.order).not.toBeDefined();
|
||||||
|
expect(controller.currentColumn).toEqual(col);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should set controller currentColumn.order to undefined then call onOrder passing currentColumn as argument`, () => {
|
||||||
|
let controller = $componentController('vnGridHeader', {});
|
||||||
|
controller.onOrder = () => {};
|
||||||
|
spyOn(controller, 'onOrder');
|
||||||
|
let col = {columnStuff: 'some stuff'};
|
||||||
|
controller.selectColum(col);
|
||||||
|
|
||||||
|
expect(controller.currentColumn).toEqual(col);
|
||||||
|
expect(controller.onOrder).toHaveBeenCalledWith(col);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1 @@
|
||||||
|
*.sql
|
|
@ -1,7 +1,12 @@
|
||||||
FROM mysql:5.6.37
|
FROM mysql:5.6.37
|
||||||
|
|
||||||
|
MAINTAINER Vicente Falco
|
||||||
|
|
||||||
ENV MYSQL_ALLOW_EMPTY_PASSWORD yes
|
ENV MYSQL_ALLOW_EMPTY_PASSWORD yes
|
||||||
|
|
||||||
|
COPY localDB01Structure.sql /docker-entrypoint-initdb.d
|
||||||
|
COPY localDB02Inserts.sql /docker-entrypoint-initdb.d
|
||||||
|
|
||||||
CMD ["mysqld"]
|
CMD ["mysqld"]
|
||||||
|
|
||||||
EXPOSE 3306
|
EXPOSE 3306
|
Loading…
Reference in New Issue