Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(examples/core): readability improvements #191

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/core/basic/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
wait_for_checkpoint!("page_interactive", 0, c);
let greeting = c.find(Locator::Css("p")).await?.text().await?;
assert_eq!(greeting, "Hello World!");
// For some reason, retrieving the inner HTML or text of a `<title>` doens't
// For some reason, retrieving the inner HTML or text of a `<title>` doesn't
// work
let title = c.find(Locator::Css("title")).await?.html(false).await?;
assert!(title.contains("Index Page"));
Expand Down
2 changes: 1 addition & 1 deletion examples/core/idb_freezing/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IndexedDB Freezing Example

This example shows how Perseus can supprot freezing state to IndexedDB and retrieving it from there later, which is the mechanism of state freezing that many apps will use. This is also the basis of Perseus' HSR system.
This example shows how Perseus can support freezing state to IndexedDB and retrieving it from there later, which is the mechanism of state freezing that many apps will use. This is also the basis of Perseus' HSR system.

Notably, this requires the `wasm-bindgen-futures` package and the `idb-freezing` feature enabled on the `perseus` package.
2 changes: 1 addition & 1 deletion examples/core/js_interop/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
wait_for_checkpoint!("page_interactive", 0, c);
let greeting = c.find(Locator::Css("p")).await?.text().await?;
assert_eq!(greeting, "Hello World!");
// For some reason, retrieving the inner HTML or text of a `<title>` doens't
// For some reason, retrieving the inner HTML or text of a `<title>` doesn't
// work
let title = c.find(Locator::Css("title")).await?.html(false).await?;
assert!(title.contains("Index Page"));
Expand Down
2 changes: 1 addition & 1 deletion examples/core/plugins/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn main(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
wait_for_checkpoint!("page_interactive", 0, c);
let greeting = c.find(Locator::Css("p")).await?.text().await?;
assert_eq!(greeting, "Hello World!");
// For some reason, retrieving the inner HTML or text of a `<title>` doens't
// For some reason, retrieving the inner HTML or text of a `<title>` doesn't
// work
let title = c.find(Locator::Css("title")).await?.html(false).await?;
assert!(title.contains("Index Page"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn get_template<G: Html>() -> Template<G> {
}

// We'll take in the path here, which will consist of the template name
// `build_paths` followed by the spcific path we're building for (as exported
// `build_paths` followed by the specific path we're building for (as exported
// from `get_build_paths`)
#[perseus::build_state]
pub async fn get_build_state(path: String, _locale: String) -> RenderFnResultWithCause<PageState> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn get_template<G: Html>() -> Template<G> {
}

// We'll take in the path here, which will consist of the template name
// `incremental_generation` followed by the spcific path we're building for (as
// `incremental_generation` followed by the specific path we're building for (as
// exported from `get_build_paths`)
#[perseus::build_state]
pub async fn get_build_state(path: String, _locale: String) -> RenderFnResultWithCause<PageState> {
Expand Down
6 changes: 3 additions & 3 deletions examples/core/state_generation/src/templates/revalidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ pub fn get_template<G: Html>() -> Template<G> {
// This page will revalidate every five seconds (and so the time displayed will be updated)
.revalidate_after("5s")
// This is an alternative method of revalidation that uses logic, which will be executed
// every itme a user tries to load this page. For that reason, this should NOT do
// every time a user tries to load this page. For that reason, this should NOT do
// long-running work, as requests will be delayed. If both this
// and `revaldiate_after()` are provided, this logic will only run when `revalidate_after()`
// and `revalidate_after()` are provided, this logic will only run when `revalidate_after()`
// tells Perseus that it should revalidate.
.should_revalidate_fn(should_revalidate)
.build_state_fn(get_build_state)
Expand All @@ -45,6 +45,6 @@ pub async fn should_revalidate(
_req: perseus::Request,
) -> RenderFnResultWithCause<bool> {
// For simplicity's sake, this will always say we should revalidate, but you
// could amke this check any condition
// could make this check any condition
Ok(true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ pub fn get_template<G: Html>() -> Template<G> {
// This page will revalidate every five seconds (and so the time displayed will be updated)
.revalidate_after(Duration::new(5, 0))
// This is an alternative method of revalidation that uses logic, which will be executed
// every itme a user tries to load this page. For that reason, this should NOT do
// every time a user tries to load this page. For that reason, this should NOT do
// long-running work, as requests will be delayed. If both this
// and `revaldiate_after()` are provided, this logic will only run when `revalidate_after()`
// and `revalidate_after()` are provided, this logic will only run when `revalidate_after()`
// tells Perseus that it should revalidate.
.should_revalidate_fn(should_revalidate)
.build_state_fn(get_build_state)
Expand Down Expand Up @@ -61,6 +61,6 @@ pub async fn should_revalidate(
_req: perseus::Request,
) -> RenderFnResultWithCause<bool> {
// For simplicity's sake, this will always say we should revalidate, but you
// could amke this check any condition
// could make this check any condition
Ok(true)
}
2 changes: 1 addition & 1 deletion examples/core/static_content/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Static Content Example

This example doesn't introduce any new code, it just shows how to host arbitrary static content with Perseus. By default, any content in the `static/` directory at the root of your project will be hosted at the URL `/.perseus/static/`, though you can also add aliases to content inside your project's root directory to be hsoted at any URL in your app. This example shows both methods, and you'll be able to find a file at `/test.txt` and at `/.perseus/static/style.css` (named so as to indicate that you would typically put stylesheets in the `static/` directory).
This example doesn't introduce any new code, it just shows how to host arbitrary static content with Perseus. By default, any content in the `static/` directory at the root of your project will be hosted at the URL `/.perseus/static/`, though you can also add aliases to content inside your project's root directory to be hosted at any URL in your app. This example shows both methods, and you'll be able to find a file at `/test.txt` and at `/.perseus/static/style.css` (named so as to indicate that you would typically put stylesheets in the `static/` directory).
2 changes: 1 addition & 1 deletion examples/core/unreactive/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
wait_for_checkpoint!("page_interactive", 0, c);
let greeting = c.find(Locator::Css("p")).await?.text().await?;
assert_eq!(greeting, "Hello World!");
// For some reason, retrieving the inner HTML or text of a `<title>` doens't
// For some reason, retrieving the inner HTML or text of a `<title>` doesn't
// work
let title = c.find(Locator::Css("title")).await?.html(false).await?;
assert!(title.contains("Index Page"));
Expand Down