up
This commit is contained in:
@@ -196,6 +196,7 @@ test('DOM: музыка независима, только следующий т
|
||||
assert.equal(spare.playCalls, 0)
|
||||
assert.equal(spare.muted, true)
|
||||
send(f.c, { action: 'play', channel: 'main' })
|
||||
send(f.c, { action: 'resume', channel: 'music' })
|
||||
f.apply()
|
||||
await setImmediate()
|
||||
assert.equal(playing.paused, false)
|
||||
@@ -465,3 +466,35 @@ for (const mode of [2, 4]) {
|
||||
assert.equal(media.paused, true)
|
||||
})
|
||||
}
|
||||
|
||||
for (const mode of [2, 4] as const) {
|
||||
test(`DOM: локальная автопауза на ${mode} затихает и продолжается с фактической позиции`, async (t) => {
|
||||
const f = await fixture(t)
|
||||
send(f.c, { action: 'volume', channel: 'music', volume: 80 })
|
||||
send(f.c, { action: 'play', channel: 'music' })
|
||||
f.apply()
|
||||
await setImmediate()
|
||||
const media = [f.a, f.b].find(m => !m.paused)!
|
||||
media.currentTime = 12
|
||||
t.mock.timers.enable({ apis: ['setInterval', 'Date'], now: 10000 })
|
||||
send(f.c, { action: 'mode', mode })
|
||||
send(f.c, { action: 'play', channel: 'main' })
|
||||
f.apply()
|
||||
await setImmediate()
|
||||
t.mock.timers.tick(500)
|
||||
assert.equal(media.paused, false)
|
||||
assert.ok(Math.abs(media.volume - 0.4) < 0.01)
|
||||
assert.equal((mode === 2 ? f.audio : f.video).paused, false)
|
||||
media.currentTime = 13
|
||||
t.mock.timers.tick(500)
|
||||
await setImmediate()
|
||||
assert.equal(media.paused, true)
|
||||
f.c.report(f.reports.filter(report => report.channel === 'music' && report.status === 'paused').at(-1)!)
|
||||
send(f.c, { action: 'mode', mode: 1 })
|
||||
f.apply()
|
||||
await setImmediate()
|
||||
assert.equal(media.paused, false)
|
||||
assert.equal(media.currentTime, 13)
|
||||
assert.equal(media.volume, 0.8)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user