Serve practice mode from the main server, add mode switch, fix touch
Practice mode is now at /practice on server.py instead of a separate server, with a button in the bottom-right corner of each page to the other mode. Touch: no double-tap zoom, no sticky hover after a tap, no long-press selection on the board, and a pressed look on tapped squares. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c52f30dc59
commit
ce6b71eb35
7 files changed
+51
-42
No files matched your search
@@ -1,23 +1,28 @@
|
||||
from aiohttp.test_utils import AioHTTPTestCase
|
||||
|
||||
import practice
|
||||
import server
|
||||
|
||||
EMPTY = {"history": [[], []], "turn": 0}
|
||||
|
||||
|
||||
class PracticeTest(AioHTTPTestCase):
|
||||
async def get_application(self):
|
||||
return practice.make_app()
|
||||
server.rooms.clear()
|
||||
return server.make_app()
|
||||
|
||||
async def play(self, body):
|
||||
res = await self.client.post("/api/play", json=body)
|
||||
return res.status, await res.json()
|
||||
|
||||
async def test_page_served(self):
|
||||
res = await self.client.get("/")
|
||||
res = await self.client.get("/practice")
|
||||
self.assertEqual(res.status, 200)
|
||||
self.assertIn("practice.js", await res.text())
|
||||
|
||||
async def test_pages_link_to_each_other(self):
|
||||
self.assertIn('href="/practice"', await (await self.client.get("/")).text())
|
||||
self.assertIn('href="/"', await (await self.client.get("/practice")).text())
|
||||
|
||||
async def test_human_move(self):
|
||||
status, s = await self.play({**EMPTY, "cell": 4})
|
||||
self.assertEqual(status, 200)
|
||||
|
||||
Reference in new issue
Block a user