-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajoute une liste de nouvelles non classés à droite qui disparaît lors…
…qu'elle est vide Co-authored-by: Clément Prod'homme <clement@captive.fr>
- Loading branch information
1 parent
fda3090
commit 85fc9e4
Showing
3 changed files
with
123 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,54 @@ | ||
@import 'commun/styles/variables.scss'; | ||
|
||
.puzzle { | ||
@mixin puzzle { | ||
position: absolute; | ||
top: 32px; | ||
left: 32px; | ||
width: 456px; | ||
padding: 4.25rem 1.5rem; | ||
} | ||
|
||
.puzzle-item { | ||
display: flex; | ||
font-size: .875rem; | ||
line-height: 1.125rem; | ||
padding: .25rem .625rem; | ||
background: $couleur-fond; | ||
border: 1px solid $bleu-gris; | ||
box-shadow: 0px 0px 8px rgba(30, 65, 106, 0.25); | ||
border-radius: .25rem; | ||
margin-bottom: 0.5rem; | ||
cursor: grab; | ||
.puzzle-gauche { | ||
@include puzzle(); | ||
left: 32px; | ||
height: 100%; | ||
} | ||
|
||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
.puzzle-droite { | ||
@include puzzle(); | ||
right: 32px; | ||
padding: 1.5rem; | ||
height: 494px; | ||
width: 456px; | ||
z-index: 1; | ||
background: $couleur-fond; | ||
border-radius: 1rem; | ||
} | ||
|
||
.puzzle-item { | ||
display: flex; | ||
font-size: .875rem; | ||
line-height: 1.125rem; | ||
padding: .25rem .625rem; | ||
background: $couleur-fond; | ||
border: 1px solid $bleu-gris; | ||
box-shadow: 0px 0px 8px rgba(30, 65, 106, 0.25); | ||
border-radius: .25rem; | ||
margin-bottom: 0.5rem; | ||
cursor: grab; | ||
|
||
.puzzle-item.sortable-chosen { | ||
&.sortable-chosen { | ||
cursor: grabbing; | ||
background: $bleu-fonce; | ||
color: $blanc; | ||
} | ||
|
||
.puzzle-icone { | ||
display: flex; | ||
align-items: center; | ||
margin-right: .625rem; | ||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.puzzle-icone { | ||
display: flex; | ||
align-items: center; | ||
margin-right: .625rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/situations/cafe_de_la_place/vues/components/puzzle.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import puzzle from 'cafe_de_la_place/vues/components/puzzle.vue'; | ||
import { shallowMount, createLocalVue } from '@vue/test-utils'; | ||
import Vuex from 'vuex'; | ||
|
||
describe('Le composant Puzzle', function () { | ||
let wrapper; | ||
let localVue; | ||
let store; | ||
|
||
function composant() { | ||
return shallowMount(puzzle, { | ||
localVue, | ||
store | ||
}); | ||
} | ||
|
||
function genereVue(nouvelles) { | ||
store = new Vuex.Store({ getters: { nouvellesDuJourNonClassees () { return nouvelles; }}}); | ||
localVue = createLocalVue(); | ||
wrapper = composant({}); | ||
} | ||
|
||
describe("quand il n'y a plus de nouvelles à classer", function () { | ||
beforeEach(function () { | ||
const nouvellesDuJourNonClassees = []; | ||
genereVue(nouvellesDuJourNonClassees); | ||
}); | ||
|
||
it("n'affiche plus le puzzle à droite", function () { | ||
expect(wrapper.vm.affichePuzzleDroite).toEqual(false); | ||
expect(wrapper.findComponent('.puzzle-droite').exists()).toBe(false); | ||
}); | ||
}); | ||
|
||
describe("quand il y a des nouvelles à classer", function () { | ||
beforeEach(function () { | ||
const nouvellesDuJourNonClassees = [{ id: 'nouvelle_1', contenu: 'Ma super nouvelle !' }]; | ||
genereVue(nouvellesDuJourNonClassees); | ||
}); | ||
|
||
it("affiche le puzzle à droite", function () { | ||
expect(wrapper.vm.affichePuzzleDroite).toEqual(true); | ||
expect(wrapper.findComponent('.puzzle-droite').exists()).toBe(true); | ||
}); | ||
}); | ||
}); |