From 308414c54bfcbf1447e3989d472ff0fd0a903e45 Mon Sep 17 00:00:00 2001 From: SooryaSoorya Date: Wed, 29 Apr 2020 01:13:41 +0300 Subject: [PATCH] test cases added --- .../movie-detail/movie-detail.component.html | 32 +++++------ .../movie-detail/movie-detail.component.scss | 30 +++++----- .../movie-detail.component.spec.ts | 25 ++++++--- src/app/movie/movie.component.html | 24 ++++---- src/app/movie/movie.component.scss | 34 +++++------ src/app/movie/movie.component.spec.ts | 6 +- src/app/movie/services/movies.service.spec.ts | 56 +++++++++++-------- src/app/nav-menu/nav-menu.component.spec.ts | 6 +- src/app/no-data/no-data.component.html | 2 +- src/app/no-data/no-data.component.scss | 2 +- src/app/search-bar/search-bar.component.html | 2 +- src/app/search-bar/search-bar.component.scss | 2 +- .../search-bar/search-bar.component.spec.ts | 18 +++--- src/app/search-bar/search-bar.component.ts | 1 - 14 files changed, 135 insertions(+), 105 deletions(-) diff --git a/src/app/movie-detail/movie-detail.component.html b/src/app/movie-detail/movie-detail.component.html index 6839e61..ea4ad6b 100644 --- a/src/app/movie-detail/movie-detail.component.html +++ b/src/app/movie-detail/movie-detail.component.html @@ -1,28 +1,28 @@ -
-
+
+
movie cover
-
-
+
+
movie poster
-
+

{{movie.Title}}

-
-
+
+ -
- movie poster + - -
-
+ -

- movie poster +

+ movie poster {{movie.Plot}}

-
+
diff --git a/src/app/movie-detail/movie-detail.component.scss b/src/app/movie-detail/movie-detail.component.scss index ec04799..a43954b 100644 --- a/src/app/movie-detail/movie-detail.component.scss +++ b/src/app/movie-detail/movie-detail.component.scss @@ -1,10 +1,10 @@ @import "variables"; -.ngmp-movie-details-container { +.ngma-movie-details-container { width: 100%; } -.ngmp-movie-cover { +.ngma-movie-cover { position: relative; max-height: 25em; overflow: hidden; @@ -42,7 +42,7 @@ } } -.ngmp-movie-details { +.ngma-movie-details { position: relative; display: flex; flex-direction: row; @@ -51,7 +51,7 @@ transform: translateY(-4em); } -.ngmp-movie-contents { +.ngma-movie-contents { padding: 0 1em; color: darken($light, 35); @@ -61,7 +61,7 @@ font-size: 44px; } - .ngmp-movie-info { + .ngma-movie-info { display: flex; justify-content: flex-start; flex-direction: row; @@ -102,7 +102,7 @@ } } - .ngmp-movie-rating-container { + .ngma-movie-rating-container { a { margin-left: 0.5em; background-color: $secondary-color; @@ -113,26 +113,26 @@ } } - .ngmp-movie-plot { + .ngma-movie-plot { max-width: 70%; line-height: 1.8; } - .ngmp-plot-img { + .ngma-plot-img { top: 10px; position: relative; height: 25px; width: 25px; } - .ngmp-star-img { + .ngma-star-img { top: 5px; position: relative; height: 25px; width: 25px; } - .ngmp-duration-img { + .ngma-duration-img { top: 10px; position: relative; height: 20px; @@ -140,15 +140,15 @@ } @media only screen and (max-width: 48em) { - .ngmp-movie-details { + .ngma-movie-details { flex-direction: column-reverse; transform: translateY(0); padding: 0 0.5em; - .ngmp-movie-poster { + .ngma-movie-poster { padding: 0 1em; } - .ngmp-movie-info { + .ngma-movie-info { display: block; div { flex-direction: column; @@ -160,14 +160,14 @@ margin-bottom: 1em; } } - .ngmp-movie-rating-container { + .ngma-movie-rating-container { flex-direction: column; span { display: block; margin-bottom: 1em; } } - .ngmp-movie-plot { + .ngma-movie-plot { max-width: 100%; } } diff --git a/src/app/movie-detail/movie-detail.component.spec.ts b/src/app/movie-detail/movie-detail.component.spec.ts index f78c44b..48c5430 100644 --- a/src/app/movie-detail/movie-detail.component.spec.ts +++ b/src/app/movie-detail/movie-detail.component.spec.ts @@ -1,17 +1,26 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { HttpClientTestingModule } from "@angular/common/http/testing"; +import { ActivatedRoute } from "@angular/router"; -import { MovieDetailComponent } from './movie-detail.component'; +import { MovieDetailComponent } from "./movie-detail.component"; +import { MovieService } from "../movie/services/movie.services"; -describe('MovieDetailComponent', () => { +describe("MovieDetailComponent", () => { let component: MovieDetailComponent; let fixture: ComponentFixture; - beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ MovieDetailComponent ] - }) - .compileComponents(); + imports: [HttpClientTestingModule], + declarations: [MovieDetailComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { snapshot: { params: { id: 1 } } }, + }, + MovieService, + ], + }).compileComponents(); })); beforeEach(() => { @@ -20,7 +29,7 @@ describe('MovieDetailComponent', () => { fixture.detectChanges(); }); - it('should create', () => { + it("should create", () => { expect(component).toBeTruthy(); }); }); diff --git a/src/app/movie/movie.component.html b/src/app/movie/movie.component.html index e3788b1..9b2bc6f 100644 --- a/src/app/movie/movie.component.html +++ b/src/app/movie/movie.component.html @@ -2,13 +2,13 @@ -
-
-
- +
+
+
+ {{movies.length}} Movies -
Sort By: +
Sort By: diff --git a/src/app/search-bar/search-bar.component.scss b/src/app/search-bar/search-bar.component.scss index 0f3e662..acad4b8 100644 --- a/src/app/search-bar/search-bar.component.scss +++ b/src/app/search-bar/search-bar.component.scss @@ -1,6 +1,6 @@ @import "variables"; -.ngmp-search-bar { +.ngma-search-bar { position: relative; input { diff --git a/src/app/search-bar/search-bar.component.spec.ts b/src/app/search-bar/search-bar.component.spec.ts index ce49237..858354f 100644 --- a/src/app/search-bar/search-bar.component.spec.ts +++ b/src/app/search-bar/search-bar.component.spec.ts @@ -1,17 +1,19 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { HttpClientTestingModule } from "@angular/common/http/testing"; -import { SearchBarComponent } from './search-bar.component'; +import { SearchBarComponent } from "./search-bar.component"; +import { MovieService } from "../movie/services/movie.services"; -describe('SearchBarComponent', () => { +describe("SearchBarComponent", () => { let component: SearchBarComponent; let fixture: ComponentFixture; - beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SearchBarComponent ] - }) - .compileComponents(); + imports: [HttpClientTestingModule], + declarations: [SearchBarComponent], + providers: [MovieService] + }).compileComponents(); })); beforeEach(() => { @@ -20,7 +22,7 @@ describe('SearchBarComponent', () => { fixture.detectChanges(); }); - it('should create', () => { + it("should create", () => { expect(component).toBeTruthy(); }); }); diff --git a/src/app/search-bar/search-bar.component.ts b/src/app/search-bar/search-bar.component.ts index f22c704..ceb8046 100644 --- a/src/app/search-bar/search-bar.component.ts +++ b/src/app/search-bar/search-bar.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, Output, EventEmitter } from "@angular/core"; import { MovieService } from "../movie/services/movie.services"; - import { Movie } from "../movie/models/movie.models"; @Component({ selector: "app-search-bar",