Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Juan Ferrer Toribio 2017-10-13 16:23:08 +02:00
commit 8fc14348d7
4 changed files with 125 additions and 2 deletions

View File

@ -12,7 +12,7 @@ describe('Component vnDropDown', () => {
beforeEach(angular.mock.inject((_$componentController_, _$timeout_, _$filter_) => {
$componentController = _$componentController_;
$element = angular.element('<div></div>');
$element = angular.element('<div><ul><li></li></ul></div>');
$timeout = _$timeout_;
$filter = _$filter_;
}));
@ -268,7 +268,7 @@ describe('Component vnDropDown', () => {
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});
controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}];
spyOn(controller, 'setScrollPosition');
@ -284,4 +284,77 @@ describe('Component vnDropDown', () => {
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));
});
});
});

View File

@ -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);
});
});
});

1
services/db/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sql

View File

@ -1,7 +1,12 @@
FROM mysql:5.6.37
MAINTAINER Vicente Falco
ENV MYSQL_ALLOW_EMPTY_PASSWORD yes
COPY localDB01Structure.sql /docker-entrypoint-initdb.d
COPY localDB02Inserts.sql /docker-entrypoint-initdb.d
CMD ["mysqld"]
EXPOSE 3306