diff --git a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html index dfe7349..5ac2f58 100644 --- a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html +++ b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html @@ -1,4 +1,4 @@ -
+ diff --git a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.spec.ts b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.spec.ts deleted file mode 100644 index cee92bc..0000000 --- a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.spec.ts +++ /dev/null @@ -1,65 +0,0 @@ -jest.mock('@ng-bootstrap/ng-bootstrap'); - -import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; -import { HttpResponse } from '@angular/common/http'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { of } from 'rxjs'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; - -import { EncuestaService } from '../service/encuesta.service'; - -import { EncuestaDeleteDialogComponent } from './encuesta-delete-dialog.component'; - -describe('Component Tests', () => { - describe('Encuesta Management Delete Component', () => { - let comp: EncuestaDeleteDialogComponent; - let fixture: ComponentFixture; - let service: EncuestaService; - let mockActiveModal: NgbActiveModal; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - declarations: [EncuestaDeleteDialogComponent], - providers: [NgbActiveModal], - }) - .overrideTemplate(EncuestaDeleteDialogComponent, '') - .compileComponents(); - fixture = TestBed.createComponent(EncuestaDeleteDialogComponent); - comp = fixture.componentInstance; - service = TestBed.inject(EncuestaService); - mockActiveModal = TestBed.inject(NgbActiveModal); - }); - - describe('confirmDelete', () => { - it('Should call delete service on confirmDelete', inject( - [], - fakeAsync(() => { - // GIVEN - jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({}))); - - // WHEN - comp.confirmDelete(123); - tick(); - - // THEN - expect(service.delete).toHaveBeenCalledWith(123); - expect(mockActiveModal.close).toHaveBeenCalledWith('deleted'); - }) - )); - - it('Should not call delete service on clear', () => { - // GIVEN - jest.spyOn(service, 'delete'); - - // WHEN - comp.cancel(); - - // THEN - expect(service.delete).not.toHaveBeenCalled(); - expect(mockActiveModal.close).not.toHaveBeenCalled(); - expect(mockActiveModal.dismiss).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts index 573c319..9c56c0e 100644 --- a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model'; import { IEncuesta } from '../encuesta.model'; import { EncuestaService } from '../service/encuesta.service'; @@ -16,8 +17,9 @@ export class EncuestaDeleteDialogComponent { this.activeModal.dismiss(); } - confirmDelete(id: number): void { - this.encuestaService.delete(id).subscribe(() => { + confirmDelete(encuesta: IEncuesta): void { + encuesta.estado = EstadoEncuesta.DELETED; + this.encuestaService.update(encuesta).subscribe(() => { this.activeModal.close('deleted'); }); } diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html index b59d686..6a4288a 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -37,11 +37,11 @@
- No encuestas found + No surveys found
-
+
    @@ -219,83 +219,69 @@
- + +
+ + + + + @@ -429,7 +415,7 @@ -