Fix transition test

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-08 22:27:14 +02:00
parent 7a453b4329
commit ecb7d9f759
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
3 changed files with 193 additions and 185 deletions

View file

@ -2,7 +2,7 @@
<div id="mobilizon"> <div id="mobilizon">
<NavBar /> <NavBar />
<main> <main>
<transition name="fade"> <transition name="fade" mode="out-in">
<router-view /> <router-view />
</transition> </transition>
</main> </main>
@ -74,7 +74,7 @@ export default class App extends Vue {
@import "~buefy/src/scss/buefy"; @import "~buefy/src/scss/buefy";
.fade-enter-active, .fade-leave-active { .fade-enter-active, .fade-leave-active {
transition: opacity .75s; transition: opacity .5s;
} }
.fade-enter, .fade-leave-to { .fade-enter, .fade-leave-to {
opacity: 0; opacity: 0;

View file

@ -1,204 +1,204 @@
<template> <template>
<div class="container"> <div class="container">
<b-loading :active.sync="$apollo.loading"></b-loading> <b-loading :active.sync="$apollo.loading"></b-loading>
<div v-if="event"> <transition appear name="fade" mode="out-in">
<div class="header-picture container"> <div v-if="event">
<figure class="image is-3by1" v-if="event.picture"> <div class="header-picture container">
<img :src="event.picture.url"> <figure class="image is-3by1" v-if="event.picture">
</figure> <img :src="event.picture.url">
<figure class="image is-3by1" v-else> </figure>
<img src="https://picsum.photos/600/200/"> <figure class="image is-3by1" v-else>
</figure> <img src="https://picsum.photos/600/200/">
</div> </figure>
<section> </div>
<div class="title-and-participate-button"> <section>
<div class="title-wrapper"> <div class="title-and-participate-button">
<div class="date-component"> <div class="title-wrapper">
<date-calendar-icon :date="event.beginsOn"></date-calendar-icon> <div class="date-component">
<date-calendar-icon :date="event.beginsOn"></date-calendar-icon>
</div>
<h1 class="title">{{ event.title }}</h1>
</div>
<div class="has-text-right" v-if="new Date(endDate) > new Date()">
<small v-if="event.participantStats.approved > 0 && !actorIsParticipant">
{{ $tc('One person is going', event.participantStats.approved, {approved: event.participantStats.approved}) }}
</small>
<small v-else-if="event.participantStats.approved > 0 && actorIsParticipant">
{{ $tc('You and one other person are going to this event', event.participantStats.approved - 1, {approved: event.participantStats.approved - 1}) }}
</small>
<participation-button
v-if="currentActor.id && !actorIsOrganizer && !event.draft"
:participation="participations[0]"
:current-actor="currentActor"
@joinEvent="joinEvent"
@joinModal="isJoinModalActive = true"
@confirmLeave="confirmLeave"
/>
</div>
<div v-else>
<button class="button is-primary" type="button" slot="trigger" disabled>
<template>
<span>{{ $t('Event already passed')}}</span>
</template>
<b-icon icon="menu-down"></b-icon>
</button>
</div> </div>
<h1 class="title">{{ event.title }}</h1>
</div> </div>
<div class="has-text-right" v-if="new Date(endDate) > new Date()"> <div class="metadata columns">
<small v-if="event.participantStats.approved > 0 && !actorIsParticipant"> <div class="column is-three-quarters-desktop">
{{ $tc('One person is going', event.participantStats.approved, {approved: event.participantStats.approved}) }} <p class="tags" v-if="event.category || event.tags.length > 0">
</small> <b-tag type="is-warning" size="is-medium" v-if="event.draft">{{ $t('Draft') }}</b-tag>
<small v-else-if="event.participantStats.approved > 0 && actorIsParticipant"> <b-tag type="is-success" v-if="event.tags" v-for="tag in event.tags" :key="tag.title">{{ tag.title }}</b-tag>
{{ $tc('You and one other person are going to this event', event.participantStats.approved - 1, {approved: event.participantStats.approved - 1}) }} <span v-if="event.tags > 0"></span>
</small> <span class="visibility" v-if="!event.draft">
<participation-button <b-tag type="is-info" v-if="event.visibility === EventVisibility.PUBLIC">{{ $t('Public event') }}</b-tag>
v-if="currentActor.id && !actorIsOrganizer && !event.draft" <b-tag type="is-info" v-if="event.visibility === EventVisibility.UNLISTED">{{ $t('Private event') }}</b-tag>
:participation="participations[0]" </span>
:current-actor="currentActor" </p>
@joinEvent="joinEvent" <div class="date-and-add-to-calendar">
@joinModal="isJoinModalActive = true" <div class="date-and-privacy" v-if="event.beginsOn">
@confirmLeave="confirmLeave" <b-icon icon="calendar-clock" />
/> <event-full-date :beginsOn="event.beginsOn" :endsOn="event.endsOn" />
</div>
<a class="add-to-calendar" @click="downloadIcsEvent()" v-if="!event.draft">
<b-icon icon="calendar-plus" />
{{ $t('Add to my calendar') }}
</a>
</div>
<p class="slug">
{{ event.slug }}
</p>
</div>
<div class="column sidebar">
<div class="field has-addons" v-if="currentActor.id">
<p class="control" v-if="actorIsOrganizer || event.draft">
<router-link
class="button"
:to="{ name: RouteName.EDIT_EVENT, params: {eventId: event.uuid}}"
>
{{ $t('Edit') }}
</router-link>
</p>
<p class="control" v-if="actorIsOrganizer || event.draft">
<a class="button is-danger" @click="openDeleteEventModalWrapper">
{{ $t('Delete') }}
</a>
</p>
<p class="control">
<a class="button is-danger" @click="isReportModalActive = true">
{{ $t('Report') }}
</a>
</p>
</div>
<div class="address-wrapper">
<b-icon icon="map" />
<span v-if="!event.physicalAddress">{{ $t('No address defined') }}</span>
<div class="address" v-if="event.physicalAddress">
<address>
<span class="addressDescription" :title="event.physicalAddress.description">{{ event.physicalAddress.description }}</span>
<span>{{ event.physicalAddress.floor }} {{ event.physicalAddress.street }}</span>
<span>{{ event.physicalAddress.postalCode }} {{ event.physicalAddress.locality }}</span>
</address>
<span class="map-show-button" @click="showMap = !showMap" v-if="event.physicalAddress && event.physicalAddress.geom">
{{ $t('Show map') }}
</span>
</div>
<b-modal v-if="event.physicalAddress && event.physicalAddress.geom" :active.sync="showMap" scroll="keep">
<div class="map">
<map-leaflet
:coords="event.physicalAddress.geom"
:popup="event.physicalAddress.description"
/>
</div>
</b-modal>
</div>
<div class="organizer">
<span>
<span v-if="event.organizerActor">
{{ $t('By {name}', {name: event.organizerActor.name ? event.organizerActor.name : event.organizerActor.preferredUsername}) }}
</span>
<figure v-if="event.organizerActor.avatar" class="image is-48x48">
<img
class="is-rounded"
:src="event.organizerActor.avatar.url"
:alt="event.organizerActor.avatar.alt" />
</figure>
</span>
</div>
</div>
</div> </div>
<div v-else> </section>
<button class="button is-primary" type="button" slot="trigger" disabled> <div class="description">
<template> <div class="description-container container">
<span>{{ $t('Event already passed')}}</span> <h3 class="title">
</template> {{ $t('About this event') }}
<b-icon icon="menu-down"></b-icon> </h3>
</button> <p v-if="!event.description">
{{ $t("The event organizer didn't add any description.") }}
</p>
<div class="columns" v-else>
<div class="column is-half" v-html="event.description">
</div>
</div>
</div> </div>
</div> </div>
<div class="metadata columns"> <section class="share" v-if="!event.draft">
<div class="column is-three-quarters-desktop"> <div class="container">
<p class="tags" v-if="event.category || event.tags.length > 0"> <div class="columns">
<b-tag type="is-warning" size="is-medium" v-if="event.draft">{{ $t('Draft') }}</b-tag> <div class="column is-half has-text-centered">
<!-- <span class="tag" v-if="event.category">{{ event.category }}</span>--> <h3 class="title">{{ $t('Share this event') }}</h3>
<b-tag type="is-success" v-if="event.tags" v-for="tag in event.tags" :key="tag.title">{{ tag.title }}</b-tag> <div>
<span v-if="event.tags > 0"></span> <b-icon icon="mastodon" size="is-large" type="is-primary" />
<span class="visibility" v-if="!event.draft"> <a :href="facebookShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="facebook" size="is-large" type="is-primary" /></a>
<b-tag type="is-info" v-if="event.visibility === EventVisibility.PUBLIC">{{ $t('Public event') }}</b-tag> <a :href="twitterShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="twitter" size="is-large" type="is-primary" /></a>
<b-tag type="is-info" v-if="event.visibility === EventVisibility.UNLISTED">{{ $t('Private event') }}</b-tag> <a :href="emailShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="email" size="is-large" type="is-primary" /></a>
</span> <!-- TODO: mailto: links are not used anymore, we should provide a popup to redact a message instead -->
</p> <a :href="linkedInShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="linkedin" size="is-large" type="is-primary" /></a>
<div class="date-and-add-to-calendar">
<div class="date-and-privacy" v-if="event.beginsOn">
<b-icon icon="calendar-clock" />
<event-full-date :beginsOn="event.beginsOn" :endsOn="event.endsOn" />
</div> </div>
<a class="add-to-calendar" @click="downloadIcsEvent()" v-if="!event.draft"> </div>
<b-icon icon="calendar-plus" /> <hr />
<div class="column is-half has-text-right add-to-calendar">
<h3 @click="downloadIcsEvent()">
{{ $t('Add to my calendar') }} {{ $t('Add to my calendar') }}
</a> </h3>
</div>
<p class="slug">
{{ event.slug }}
</p>
</div>
<div class="column sidebar">
<div class="field has-addons" v-if="currentActor.id">
<p class="control" v-if="actorIsOrganizer || event.draft">
<router-link
class="button"
:to="{ name: RouteName.EDIT_EVENT, params: {eventId: event.uuid}}"
>
{{ $t('Edit') }}
</router-link>
</p>
<p class="control" v-if="actorIsOrganizer || event.draft">
<a class="button is-danger" @click="openDeleteEventModalWrapper">
{{ $t('Delete') }}
</a>
</p>
<p class="control">
<a class="button is-danger" @click="isReportModalActive = true">
{{ $t('Report') }}
</a>
</p>
</div>
<div class="address-wrapper">
<b-icon icon="map" />
<span v-if="!event.physicalAddress">{{ $t('No address defined') }}</span>
<div class="address" v-if="event.physicalAddress">
<address>
<span class="addressDescription" :title="event.physicalAddress.description">{{ event.physicalAddress.description }}</span>
<span>{{ event.physicalAddress.floor }} {{ event.physicalAddress.street }}</span>
<span>{{ event.physicalAddress.postalCode }} {{ event.physicalAddress.locality }}</span>
<!-- <span>{{ event.physicalAddress.region }} {{ event.physicalAddress.country }}</span>-->
</address>
<span class="map-show-button" @click="showMap = !showMap" v-if="event.physicalAddress && event.physicalAddress.geom">
{{ $t('Show map') }}
</span>
</div>
<b-modal v-if="event.physicalAddress && event.physicalAddress.geom" :active.sync="showMap" scroll="keep">
<div class="map">
<map-leaflet
:coords="event.physicalAddress.geom"
:popup="event.physicalAddress.description"
/>
</div>
</b-modal>
</div>
<div class="organizer">
<span>
<span v-if="event.organizerActor">
{{ $t('By {name}', {name: event.organizerActor.name ? event.organizerActor.name : event.organizerActor.preferredUsername}) }}
</span>
<figure v-if="event.organizerActor.avatar" class="image is-48x48">
<img
class="is-rounded"
:src="event.organizerActor.avatar.url"
:alt="event.organizerActor.avatar.alt" />
</figure>
</span>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<div class="description"> <section class="more-events container" v-if="event.relatedEvents.length > 0">
<div class="description-container container"> <h3 class="title has-text-centered">{{ $t('These events may interest you') }}</h3>
<h3 class="title">
{{ $t('About this event') }}
</h3>
<p v-if="!event.description">
{{ $t("The event organizer didn't add any description.") }}
</p>
<div class="columns" v-else>
<div class="column is-half" v-html="event.description">
</div>
</div>
</div>
</div>
<section class="share" v-if="!event.draft">
<div class="container">
<div class="columns"> <div class="columns">
<div class="column is-half has-text-centered"> <div class="column is-one-third-desktop" v-for="relatedEvent in event.relatedEvents" :key="relatedEvent.uuid">
<h3 class="title">{{ $t('Share this event') }}</h3> <EventCard :event="relatedEvent" />
<div>
<b-icon icon="mastodon" size="is-large" type="is-primary" />
<a :href="facebookShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="facebook" size="is-large" type="is-primary" /></a>
<a :href="twitterShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="twitter" size="is-large" type="is-primary" /></a>
<a :href="emailShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="email" size="is-large" type="is-primary" /></a>
<!-- TODO: mailto: links are not used anymore, we should provide a popup to redact a message instead -->
<a :href="linkedInShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="linkedin" size="is-large" type="is-primary" /></a>
</div>
</div>
<hr />
<div class="column is-half has-text-right add-to-calendar">
<h3 @click="downloadIcsEvent()">
{{ $t('Add to my calendar') }}
</h3>
</div> </div>
</div> </div>
</section>
<b-modal :active.sync="isReportModalActive" has-modal-card ref="reportModal">
<report-modal :on-confirm="reportEvent" :title="$t('Report this event')" :outside-domain="event.organizerActor.domain" @close="$refs.reportModal.close()" />
</b-modal>
<b-modal :active.sync="isJoinModalActive" has-modal-card ref="participationModal">
<identity-picker v-model="identity">
<template v-slot:footer>
<footer class="modal-card-foot">
<button
class="button"
ref="cancelButton"
@click="isJoinModalActive = false">
{{ $t('Cancel') }}
</button>
<button
class="button is-primary"
ref="confirmButton"
@click="joinEvent(identity)">
{{ $t('Confirm my particpation') }}
</button>
</footer>
</template>
</identity-picker>
</b-modal>
</div> </div>
</section> </transition>
<section class="more-events container" v-if="event.relatedEvents.length > 0"> </div>
<h3 class="title has-text-centered">{{ $t('These events may interest you') }}</h3>
<div class="columns">
<div class="column is-one-third-desktop" v-for="relatedEvent in event.relatedEvents" :key="relatedEvent.uuid">
<EventCard :event="relatedEvent" />
</div>
</div>
</section>
<b-modal :active.sync="isReportModalActive" has-modal-card ref="reportModal">
<report-modal :on-confirm="reportEvent" :title="$t('Report this event')" :outside-domain="event.organizerActor.domain" @close="$refs.reportModal.close()" />
</b-modal>
<b-modal :active.sync="isJoinModalActive" has-modal-card ref="participationModal">
<identity-picker v-model="identity">
<template v-slot:footer>
<footer class="modal-card-foot">
<button
class="button"
ref="cancelButton"
@click="isJoinModalActive = false">
{{ $t('Cancel') }}
</button>
<button
class="button is-primary"
ref="confirmButton"
@click="joinEvent(identity)">
{{ $t('Confirm my particpation') }}
</button>
</footer>
</template>
</identity-picker>
</b-modal>
</div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -482,6 +482,13 @@ export default class Event extends EventMixin {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../variables"; @import "../../variables";
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
div.sidebar { div.sidebar {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;

View file

@ -39,6 +39,7 @@ describe('Registration', () => {
cy.get('form').contains('button.button.is-primary', 'Register').click(); cy.get('form').contains('button.button.is-primary', 'Register').click();
cy.url().should('include', '/register/profile'); cy.url().should('include', '/register/profile');
cy.wait(1000);
cy.get('form .field').first().contains('label', 'Username').parent().find('input').type('tester'); cy.get('form .field').first().contains('label', 'Username').parent().find('input').type('tester');
cy.get('form .field').eq(2).contains('label', 'Displayed name').parent().find('input').type('tester account'); cy.get('form .field').eq(2).contains('label', 'Displayed name').parent().find('input').type('tester account');
cy.get('form .field').eq(3).contains('label', 'Description').parent().find('textarea').type('This is a test account'); cy.get('form .field').eq(3).contains('label', 'Description').parent().find('textarea').type('This is a test account');