From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__name@dasherize__.guard.spec.ts.template | 16 +++++++++++ .../files/__name@dasherize__.guard.ts.template | 31 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template create mode 100644 sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files') diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template new file mode 100644 index 00000000..0ce1ff44 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { <%= classify(name) %>Guard } from './<%= dasherize(name) %>.guard'; + +describe('<%= classify(name) %>Guard', () => { + let guard: <%= classify(name) %>Guard; + + beforeEach(() => { + TestBed.configureTestingModule({}); + guard = TestBed.inject(<%= classify(name) %>Guard); + }); + + it('should be created', () => { + expect(guard).toBeTruthy(); + }); +}); diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template new file mode 100644 index 00000000..3dc36a01 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { <%= implementationImports %> } from '@angular/router'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class <%= classify(name) %>Guard implements <%= implementations %> { + <% if (implements.includes('CanActivate')) { %>canActivate( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + return true; + } + <% } %><% if (implements.includes('CanActivateChild')) { %>canActivateChild( + childRoute: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + return true; + } + <% } %><% if (implements.includes('CanDeactivate')) { %>canDeactivate( + component: unknown, + currentRoute: ActivatedRouteSnapshot, + currentState: RouterStateSnapshot, + nextState?: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + return true; + } + <% } %><% if (implements.includes('CanLoad')) { %>canLoad( + route: Route, + segments: UrlSegment[]): Observable | Promise | boolean | UrlTree { + return true; + }<% } %> +} -- cgit v1.2.3