Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cristinecula committed Dec 6, 2023
1 parent 8d7686a commit ae424b8
Showing 1 changed file with 52 additions and 50 deletions.
102 changes: 52 additions & 50 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,63 +137,65 @@ suite('cosmoz-image-viewer', () => {
});
});
});
// suite('cosmoz-image-viewer-no-images', () => {
// let imageViewer;

// setup(async () => {
// imageViewer = await fixture(cosmozImageViewerFixture);
// Object.assign(imageViewer, {
// images: [],
// showZoom: true,
// showNav: true,
// showFullscreen: true,
// showDetach: true,
// });
// });
suite('cosmoz-image-viewer with no images', () => {
let imageViewer;
setup(async () => {
await fixture(
html`<cosmoz-image-viewer
show-zoom
show-nav
show-fullscreen
show-page-number
show-detach
.images=${[]}
></cosmoz-image-viewer>`,
);
});

// test('action items are hidden', () => {
// assert.equal(imageViewer._showNav, false);
// assert.equal(imageViewer._showZoom, false);
// assert.equal(imageViewer._showFullscreen, false);
// assert.equal(imageViewer._showDetach, false);
// });
test('action items are hidden', () => {
assert.equal(imageViewer._showNav, false);
assert.equal(imageViewer._showZoom, false);
assert.equal(imageViewer._showFullscreen, false);
assert.equal(imageViewer._showDetach, false);
});

// test('no image info is shown', () => {
// assert.equal(imageViewer._hideNoImageInfo, false);
// });
// });
test('no image info is shown', () => {
assert.equal(imageViewer._hideNoImageInfo, false);
});
});

// suite('cosmoz-image-viewer-loading-error', () => {
// let imageViewer;
// const errorDiv = () => imageViewer.$.slider.querySelector('.error'),
// displayNone = (element) =>
// element.offsetParent === null ||
// element.getAttribute('hidden') === 'true';
suite('cosmoz-image-viewer-loading-error', () => {
let imageViewer;
const errorDiv = () => imageViewer.$.slider.querySelector('.error'),
displayNone = (element) =>
element.offsetParent === null ||
element.getAttribute('hidden') === 'true';

// setup(async () => {
// imageViewer = await fixture(cosmozImageViewerFixture);
// imageViewer.images = [
// 'xyz.jpg',
// '/stories/images/stockholm.jpg',
// '/stories/images/strasbourg.jpg',
// ];
// await nextFrame();
// });
setup(async () => {
imageViewer = await fixture(cosmozImageViewerFixture);
imageViewer.images = [
'xyz.jpg',
'/stories/images/stockholm.jpg',
'/stories/images/strasbourg.jpg',
];
await nextFrame();
});

// test('error is shown', async () => {
// const errEl = errorDiv();
// await aTimeout(500);
// assert.equal(displayNone(errEl), false);
// });
test('error is shown', async () => {
const errEl = errorDiv();
await aTimeout(500);
assert.equal(displayNone(errEl), false);
});

// test('error is hidden if next image loaded successfully', async () => {
// imageViewer.nextImage();
// await nextFrame();
// await aTimeout(500);
// const errEl = errorDiv();
// assert.equal(displayNone(errEl), true);
// });
// });
test('error is hidden if next image loaded successfully', async () => {
imageViewer.nextImage();
await nextFrame();
await aTimeout(500);
const errEl = errorDiv();
assert.equal(displayNone(errEl), true);
});
});

// suite('cosmoz-image-viewer-overlay', () => {
// let overlay;
Expand Down

0 comments on commit ae424b8

Please sign in to comment.