parent
7fdbd72f13
commit
380d2a0d45
|
@ -307,7 +307,10 @@
|
|||
expired: ({ poll }) => poll.expired,
|
||||
expiresAt: ({ poll }) => poll.expires_at,
|
||||
// Misskey can have polls that never end. These give expiresAt as null
|
||||
expiresAtTS: ({ expiresAt }) => typeof expiresAt === 'number' ? new Date(expiresAt).getTime() : null,
|
||||
// Also, Mastodon v4+ uses ISO strings, whereas Mastodon pre-v4 used numbers
|
||||
expiresAtTS: ({ expiresAt }) => (
|
||||
(typeof expiresAt === 'number' || typeof expiresAt === 'string') ? new Date(expiresAt).getTime() : null
|
||||
),
|
||||
expiresAtTimeagoFormatted: ({ expiresAtTS, expired, $now }) => (
|
||||
expired ? formatTimeagoDate(expiresAtTS, $now) : formatTimeagoFutureDate(expiresAtTS, $now)
|
||||
),
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
sleep,
|
||||
getNthStatusPollRefreshButton,
|
||||
getNthStatusPollVoteCount,
|
||||
getNthStatusRelativeDate, getUrl, goBack, getNthStatusSpoiler, getNthShowOrHideButton
|
||||
getNthStatusRelativeDate, getUrl, goBack, getNthStatusSpoiler, getNthShowOrHideButton, getNthStatusPollExpiry
|
||||
} from '../utils'
|
||||
import { loginAsFoobar } from '../roles'
|
||||
import { createPollAs, voteOnPollAs } from '../serverActions'
|
||||
|
@ -22,6 +22,7 @@ test('Can vote on polls', async t => {
|
|||
await t
|
||||
.expect(getNthStatusContent(1).innerText).contains('vote on my cool poll')
|
||||
.expect(getNthStatusPollVoteCount(1).innerText).eql('0 votes')
|
||||
.expect(getNthStatusPollExpiry(1).innerText).match(/Ends in .*/)
|
||||
await sleep(1000)
|
||||
await t
|
||||
.click(getNthStatusPollOption(1, 2))
|
||||
|
@ -32,6 +33,7 @@ test('Can vote on polls', async t => {
|
|||
.expect(getNthStatusPollResult(1, 1).innerText).eql('0% yes')
|
||||
.expect(getNthStatusPollResult(1, 2).innerText).eql('100% no')
|
||||
.expect(getNthStatusPollVoteCount(1).innerText).eql('1 vote')
|
||||
.expect(getNthStatusPollExpiry(1).innerText).match(/Ends in .*/)
|
||||
})
|
||||
|
||||
test('Can vote on multiple-choice polls', async t => {
|
||||
|
|
|
@ -394,6 +394,10 @@ export function getNthStatusPollVoteCount (n) {
|
|||
return $(`${getNthStatusSelector(n)} .poll .poll-stat:nth-child(1) .poll-stat-text`)
|
||||
}
|
||||
|
||||
export function getNthStatusPollExpiry (n) {
|
||||
return $(`${getNthStatusSelector(n)} .poll .poll-stat-expiry`)
|
||||
}
|
||||
|
||||
export function getComposePollNthInput (n) {
|
||||
return $(`.compose-poll input[type="text"]:nth-of-type(${n})`)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue