From 3e325c506745f7da26798d7728412e4724e17159 Mon Sep 17 00:00:00 2001 From: Jose Pinto Date: Fri, 1 Mar 2019 14:37:49 -0300 Subject: [PATCH] espacios y corrijo errores test --- spec/controllerSpec.js | 5 ++--- spec/controllerSpecCrearPedido.js | 5 +++-- src/js/controller.js | 33 +++++++++++++++------------------ 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/spec/controllerSpec.js b/spec/controllerSpec.js index 501395d..6fbc44a 100644 --- a/spec/controllerSpec.js +++ b/spec/controllerSpec.js @@ -990,7 +990,6 @@ describe('Controladores módulo crear nota de pedido', function() { scope.notaPedido.articulosNotaPedido = [{ precio: 2, cantidad: 1}]; var esperado = 2; var resultado = scope.getTotal(); - console.log('resultado', resultado); //assert expect(resultado).toEqual(esperado); @@ -1739,8 +1738,8 @@ describe('Controladores módulo crear nota de pedido', function() { crearNotaPedidoService: { getNumeroNotaPedido: function() { return { - then: function() { } - }; + then: function() { } + }; }, getBotonera: function() { }, getCotizacionByIdMoneda: function() { diff --git a/spec/controllerSpecCrearPedido.js b/spec/controllerSpecCrearPedido.js index 9b351d7..c2fba18 100644 --- a/spec/controllerSpecCrearPedido.js +++ b/spec/controllerSpecCrearPedido.js @@ -886,11 +886,12 @@ describe('Controladores módulo crear nota de pedido', function() { spyOn(notaPedidoBusinessService, 'addArticulos'); scope.crearNotaPedido(); //expect - crearNotaPedidoService.crearNotaPedido().then(function() { + + promesa.then(function() { expect(focaSeguimientoService.guardarPosicion).toHaveBeenCalled(); expect(notaPedidoBusinessService.addArticulos).toHaveBeenCalled(); done(); - }).catch(done); + }); }); }); diff --git a/src/js/controller.js b/src/js/controller.js index 4dc7655..bbf21fc 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -61,12 +61,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', ); $scope.inicial.cotizacion = $scope.notaPedido.cotizacion; - }); - + init(); $timeout(function() {getLSNotaPedido();}); - } function init() { @@ -83,7 +81,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', articulosNotaPedido: [], notaPedidoPlazo: [] }; - $scope.idLista = undefined; crearNotaPedidoService.getNumeroNotaPedido().then( @@ -129,33 +126,33 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', }, true); $scope.crearNotaPedido = function() { - if(!$scope.notaPedido.vendedor.id) { + if (!$scope.notaPedido.vendedor.id) { focaModalService.alert('Ingrese Vendedor'); return; - } else if(!$scope.notaPedido.cliente.COD) { + } else if (!$scope.notaPedido.cliente.COD) { focaModalService.alert('Ingrese Cliente'); return; - } else if(!$scope.notaPedido.proveedor.COD) { + } else if (!$scope.notaPedido.proveedor.COD) { focaModalService.alert('Ingrese Proveedor'); return; - } else if(!$scope.notaPedido.cotizacion.ID) { + } else if (!$scope.notaPedido.cotizacion.ID) { focaModalService.alert('Ingrese Cotización'); return; - } else if(!$scope.notaPedido.cotizacion.moneda.ID) { + } else if (!$scope.notaPedido.cotizacion.moneda.ID) { focaModalService.alert('Ingrese Moneda'); return; - } else if(!$scope.notaPedido.notaPedidoPlazo) { + } else if (!$scope.notaPedido.notaPedidoPlazo) { focaModalService.alert('Ingrese Precios y Condiciones'); return; - } else if( + } else if ( $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) { focaModalService.alert('Ingrese Flete'); return; - } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto + } else if (!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto focaModalService.alert('Ingrese Domicilio'); return; - } else if($scope.notaPedido.articulosNotaPedido.length === 0) { + } else if ($scope.notaPedido.articulosNotaPedido.length === 0) { focaModalService.alert('Debe cargar al menos un articulo'); return; } @@ -169,7 +166,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', nombreCliente: $scope.notaPedido.cliente.NOM, cuitCliente: $scope.notaPedido.cliente.CUIT, idProveedor: $scope.notaPedido.proveedor.COD, - idDomicilio: $scope.notaPedido.idDomicilio || $scope.notaPedido.domicilio.id, + idDomicilio: $scope.notaPedido.domicilio.id, idCotizacion: $scope.notaPedido.cotizacion.ID, idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, @@ -845,19 +842,19 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', function valorPrecioCondicion() { - if(notaPedido.idPrecioCondicion > 0) { + if (notaPedido.idPrecioCondicion > 0) { return notaPedido.precioCondicion.nombre; } else { return 'Ingreso Manual'; } } - if(notaPedido.flete === 1) { + if (notaPedido.flete === 1) { var cabeceraBomba = { label: 'Bomba:', valor: notaPedido.bomba === 1 ? 'Si' : 'No' }; - if(notaPedido.kilometros) { + if (notaPedido.kilometros) { var cabeceraKilometros = { label: 'Kilometros:', valor: notaPedido.kilometros @@ -870,7 +867,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', notaPedidoBusinessService.calcularArticulos($scope.notaPedido.articulosNotaPedido, notaPedido.cotizacion.VENDEDOR); - if(notaPedido.idPrecioCondicion > 0) { + if (notaPedido.idPrecioCondicion > 0) { $scope.idLista = notaPedido.precioCondicion.idListaPrecio; } else { $scope.idLista = -1; -- 1.9.1