anggoran
anggoran
DDeno
Created by anggoran on 5/11/2024 in #help
Managing Test Scripts
is this a good practice?
// main_test.ts
import { createHandler, ServeHandlerInfo } from "$fresh/server.ts";
import manifest from "../fresh.gen.ts";
import config from "../fresh.config.ts";
import * as listening from "./listening.ts";
import * as reading from "./reading.ts";

export const CONNECTION: ServeHandlerInfo = {
remoteAddr: { hostname: "localhost", port: 8000, transport: "tcp" },
};
export const handler = await createHandler(manifest, config);

Deno.test("Feature: Listening Pinyin", async (t) => {
await t.step("Get the question", listening.getQuestion);
await t.step("Post the answer", listening.postAnswer);
await t.step("Get the correct state", listening.getCorrectState);
await t.step("Get the false state", listening.getFalseState);
});

Deno.test("Feature: Reading Hanzi", async (t) => {
await t.step("Render creation form", reading.renderCreationForm);
await t.step("Start a quiz", reading.startQuiz);
await t.step("Post the answer", reading.postAnswer);
await t.step("Get correct state", reading.getCorrectState);
await t.step("Get false state", reading.getFalseState);
});
// main_test.ts
import { createHandler, ServeHandlerInfo } from "$fresh/server.ts";
import manifest from "../fresh.gen.ts";
import config from "../fresh.config.ts";
import * as listening from "./listening.ts";
import * as reading from "./reading.ts";

export const CONNECTION: ServeHandlerInfo = {
remoteAddr: { hostname: "localhost", port: 8000, transport: "tcp" },
};
export const handler = await createHandler(manifest, config);

Deno.test("Feature: Listening Pinyin", async (t) => {
await t.step("Get the question", listening.getQuestion);
await t.step("Post the answer", listening.postAnswer);
await t.step("Get the correct state", listening.getCorrectState);
await t.step("Get the false state", listening.getFalseState);
});

Deno.test("Feature: Reading Hanzi", async (t) => {
await t.step("Render creation form", reading.renderCreationForm);
await t.step("Start a quiz", reading.startQuiz);
await t.step("Post the answer", reading.postAnswer);
await t.step("Get correct state", reading.getCorrectState);
await t.step("Get false state", reading.getFalseState);
});
3 replies
DDeno
Created by anggoran on 5/2/2024 in #help
SpeechRecognition is not found
I'll make an issue for this
3 replies
DDeno
Created by anggoran on 4/27/2024 in #help
Redirection in Testing is Always Valued False
like the follow redirect behavior in request is not automatically redirecting when tested outside browser
4 replies
DDeno
Created by anggoran on 4/27/2024 in #help
Redirection in Testing is Always Valued False
I guess it's how it works on server compared to browser (?)
4 replies
DDeno
Created by anggoran on 4/14/2024 in #help
Partial with Forms
I'm kinda confused with how to place the partial when using form, like is it just to treat submit button as link after submission or else
15 replies
DDeno
Created by anggoran on 4/14/2024 in #help
Partial with Forms
I think I need a demo repo for using form with partial... Is there any on Github?
15 replies
DDeno
Created by anggoran on 4/14/2024 in #help
Partial with Forms
These are what I got from the discussion: Native form need to redirect after server side submission, while partial do client-side navigation. So using form with partial helps us to do server-side data handling with client-side state update, with to-be-inserted html as a response. Partial isn't just conditional in initial state or island. It doesn't refresh full page, only update necessary parts.
15 replies
DDeno
Created by anggoran on 4/14/2024 in #help
Partial with Forms
Also what is the difference with usual conditional like this?
condition ? <tag>hello</tag> : <tag>hi</tag>
condition ? <tag>hello</tag> : <tag>hi</tag>
15 replies
DDeno
Created by anggoran on 4/14/2024 in #help
Partial with Forms
How the insert works? Can I replace existing content?
15 replies
DDeno
Created by anggoran on 4/14/2024 in #help
Partial with Forms
What the POST handler should return? Do I need a redirection or just navigate with the button? How if I want to get the sent data with url params?
15 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
To use Partial after submitting form with native POST handler, we redirect to Partial inside the handler?
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
Thanks a lot guyss
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
For the logic, it's like: 1. Get the question. 2. Fill in the answer. 3. Submit the form. 4. Match answer to solution. 5. Return if it's correct / wrong. 6. Render the result without refresh. 7. Clear state, move on to the next question.
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
I was thinking about these possibilities: 1. Handle entire logic in the POST handler => return result via response of the POST request. 2. Send answer with POST handler => GET page again to get the result.
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
so like to update only some section, maybe like partial I think
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
After I submitted the form with POST, I want to GET the result (correct / wrong) in the same page without refreshing the entire page, what should I do?
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
to go to the next question, should I do it with Partial?
17 replies
DDeno
Created by anggoran on 4/3/2024 in #help
Signals & Data Fetching
alright, thank you very much!
16 replies
DDeno
Created by anggoran on 4/3/2024 in #help
Signals & Data Fetching
in the tutorial it is stated that As a shortcut for combining a GET handler with a route, you can define your route as async. , so to fetch on server, async route and GET handler are the same?
16 replies
DDeno
Created by anggoran on 4/3/2024 in #help
Signals & Data Fetching
I'm kinda confused about the solution, since we can't declare useSignal within async route.
16 replies