@spectrum-web-components/thumbnail
Advanced tools
Comparing version 0.42.4 to 0.42.5
{ | ||
"name": "@spectrum-web-components/thumbnail", | ||
"version": "0.42.4", | ||
"version": "0.42.5", | ||
"publishConfig": { | ||
@@ -60,4 +60,4 @@ "access": "public" | ||
"dependencies": { | ||
"@spectrum-web-components/base": "^0.42.4", | ||
"@spectrum-web-components/opacity-checkerboard": "^0.42.4" | ||
"@spectrum-web-components/base": "^0.42.5", | ||
"@spectrum-web-components/opacity-checkerboard": "^0.42.5" | ||
}, | ||
@@ -73,3 +73,3 @@ "devDependencies": { | ||
], | ||
"gitHead": "4924ffd06681ced537edaed873a9ce8b42cf155c" | ||
"gitHead": "f29fd737947945de8cd6f5bc03fb389d386c9c3a" | ||
} |
@@ -6,20 +6,17 @@ "use strict"; | ||
import { testForLitDevWarnings } from "../../../test/testing-helpers.js"; | ||
import { stub } from "sinon"; | ||
describe("Thumbnail", () => { | ||
testForLitDevWarnings( | ||
async () => await fixture( | ||
html` | ||
<sp-thumbnail> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
` | ||
) | ||
); | ||
it("loads default thumbnail accessibly", async () => { | ||
const el = await fixture( | ||
html` | ||
async () => await fixture(html` | ||
<sp-thumbnail> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
` | ||
); | ||
`) | ||
); | ||
it("loads default thumbnail accessibly", async () => { | ||
const el = await fixture(html` | ||
<sp-thumbnail> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
`); | ||
await elementUpdated(el); | ||
@@ -29,9 +26,7 @@ await expect(el).to.be.accessible(); | ||
it("can be size `50`", async () => { | ||
const el = await fixture( | ||
html` | ||
<sp-thumbnail size="50"> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
` | ||
); | ||
const el = await fixture(html` | ||
<sp-thumbnail size="50"> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
`); | ||
await elementUpdated(el); | ||
@@ -41,13 +36,48 @@ expect(el.size).to.equal("50"); | ||
it("accepts `background`", async () => { | ||
const el = await fixture( | ||
html` | ||
<sp-thumbnail background="blue"> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
` | ||
); | ||
const el = await fixture(html` | ||
<sp-thumbnail background="blue"> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
`); | ||
const background = el.shadowRoot.querySelector(".background"); | ||
expect(background).to.not.be.null; | ||
}); | ||
describe("dev mode", () => { | ||
let consoleWarnStub; | ||
before(() => { | ||
window.__swc.verbose = true; | ||
consoleWarnStub = stub(console, "warn"); | ||
}); | ||
afterEach(() => { | ||
consoleWarnStub.resetHistory(); | ||
}); | ||
after(() => { | ||
window.__swc.verbose = false; | ||
consoleWarnStub.restore(); | ||
}); | ||
it("warns in devMode when white/black variant is provided", async () => { | ||
const el = await fixture(html` | ||
<sp-thumbnail background="blue" size="xxs"> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
`); | ||
await elementUpdated(el); | ||
expect(consoleWarnStub.called).to.be.true; | ||
const spyCall = consoleWarnStub.getCall(0); | ||
expect( | ||
spyCall.args.at(0).includes( | ||
"no longer supports the value" | ||
), | ||
"confirm deprecated size warning" | ||
).to.be.true; | ||
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({ | ||
data: { | ||
localName: "sp-thumbnail", | ||
type: "api", | ||
level: "deprecation" | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=thumbnail.test.js.map |
Sorry, the diff of this file is not supported yet
919893
2280