Test Film component
This commit is contained in:
30
components/Film/Film.spec.js
Normal file
30
components/Film/Film.spec.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { mount, RouterLinkStub } from "@vue/test-utils";
|
||||||
|
import Film from "@/components/Film/Film";
|
||||||
|
import mockFilms from "@/test/fake-films.json";
|
||||||
|
|
||||||
|
describe("Film", () => {
|
||||||
|
it("tests props", () => {
|
||||||
|
expect(Film.props).toMatchObject({
|
||||||
|
film: {
|
||||||
|
type: Object,
|
||||||
|
default: {},
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders proper link to details", () => {
|
||||||
|
const wrapper = mount(Film, {
|
||||||
|
propsData: {
|
||||||
|
film: mockFilms[0]
|
||||||
|
},
|
||||||
|
stubs: {
|
||||||
|
RouterLink: RouterLinkStub
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe(
|
||||||
|
`/film/${mockFilms[0].id}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -43,7 +43,7 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
film: {
|
film: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: {},
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -56,22 +56,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
/* .film {
|
|
||||||
flex: 1 1 calc(50% - 2rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 600px) {
|
|
||||||
.card {
|
|
||||||
flex: 1 1 calc(50% - 2rem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 900px) {
|
|
||||||
.card {
|
|
||||||
flex: 1 1 calc(33% - 2rem);
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
header {
|
header {
|
||||||
background-color: #85ffbd;
|
background-color: #85ffbd;
|
||||||
background-image: linear-gradient(45deg, #85ffbd 0%, #fffb7d 100%);
|
background-image: linear-gradient(45deg, #85ffbd 0%, #fffb7d 100%);
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Film from "./Film";
|
import Film from "./Film/Film";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Film },
|
components: { Film },
|
||||||
|
|||||||
Reference in New Issue
Block a user