This commit is contained in:
@@ -30,7 +30,7 @@ describe('CategorySection', () => {
|
||||
const imgs = screen.getAllByRole('img');
|
||||
const links = screen.getAllByRole('link');
|
||||
|
||||
expect(imgs).toHaveLength(3); //.length()
|
||||
expect(links).toHaveLength(3);
|
||||
expect(imgs).toHaveLength(3); //.length() - from chai - TestFramework
|
||||
expect(links).toHaveLength(3); // .lengthOf()
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('Footer', () => {
|
||||
|
||||
navItems.forEach((item) => {
|
||||
const spanEl = screen.getByText(item.name);
|
||||
const linkEl = spanEl.parentElement;
|
||||
const linkEl = spanEl.parentNode;
|
||||
expect(spanEl).toBeInTheDocument();
|
||||
expect(linkEl).toHaveAttribute('href', item.href);
|
||||
});
|
||||
|
||||
@@ -65,11 +65,11 @@ describe('ImageGallery', () => {
|
||||
|
||||
const user = userEvent.setup();
|
||||
|
||||
expect(mainImage).toBeInTheDocument();
|
||||
expect(mainImage).toHaveAttribute('src', product.images[0]);
|
||||
|
||||
await user.keyboard('{ArrowRight}');
|
||||
|
||||
expect(mainImage).toBeInTheDocument();
|
||||
expect(mainImage).toHaveAttribute('src', product.images[1]);
|
||||
});
|
||||
|
||||
@@ -79,6 +79,7 @@ describe('ImageGallery', () => {
|
||||
|
||||
const user = userEvent.setup();
|
||||
|
||||
expect(mainImage).toBeInTheDocument();
|
||||
expect(mainImage).toHaveAttribute('src', product.images[0]);
|
||||
await user.keyboard('{ArrowRight}');
|
||||
|
||||
@@ -86,7 +87,6 @@ describe('ImageGallery', () => {
|
||||
|
||||
await user.keyboard('{ArrowLeft}');
|
||||
|
||||
expect(mainImage).toBeInTheDocument();
|
||||
expect(mainImage).toHaveAttribute('src', product.images[0]);
|
||||
});
|
||||
|
||||
@@ -96,10 +96,11 @@ describe('ImageGallery', () => {
|
||||
|
||||
const user = userEvent.setup();
|
||||
|
||||
expect(mainImage).toBeInTheDocument();
|
||||
expect(mainImage).toHaveAttribute('src', product.images[0]);
|
||||
|
||||
await user.keyboard('{ArrowLeft}');
|
||||
|
||||
expect(mainImage).toBeInTheDocument();
|
||||
expect(mainImage).toHaveAttribute('src', product.images[product.images.length - 1]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user