Skip to content

Instantly share code, notes, and snippets.

@duizendnegen
Created November 22, 2017 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duizendnegen/57fcba882e5b37a9d14a89af546bab6a to your computer and use it in GitHub Desktop.
Save duizendnegen/57fcba882e5b37a9d14a89af546bab6a to your computer and use it in GitHub Desktop.
import { MockComponent } from 'ng2-mock-component';
import { By } from '@angular/platform-browser';
describe('ImgGalleryComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
ImgGalleryComponent,
MockComponent({selector: 'app-img-carousel', inputs: ['images', 'currentSlide', 'isFullscreen']})
]
})
.compileComponents();
}));
// ... more setup
it('should contain a carousel', () => {
const carousel = fixture.debugElement.query(By.css('app-img-carousel'))
expect(carousel).toBeTruthy();
const carouselComponent = carousel.componentInstance;
expect(carouselComponent.isFullscreen).toBe(true);
expect(carouselComponent.images.length).toBe(3);
expect(carouselComponent.currentSlide).toBe(0);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment