Define la estructura para tests y ejemplos

This commit is contained in:
Manuel Cillero 2023-06-09 10:33:54 +02:00
parent cd76355430
commit 0af85c4d77
14 changed files with 74 additions and 24 deletions

View file

@ -202,10 +202,10 @@ pub struct Settings {
/// Ver [`Settings`].
pub struct App {
/// El nombre de la aplicación.
/// Por defecto: *"PageTop Application"*.
/// Por defecto: *"PageTop App"*.
pub name: String,
/// Una descripción breve de la aplicación.
/// Por defecto: *"Developed with the amazing PageTop framework."*.
/// Por defecto: *"Modular web solutions made simple with PageTop."*.
pub description: String,
/// Tema predeterminado.
/// Por defecto: *"Basic"*.
@ -308,8 +308,8 @@ pub struct Server {
define_config!(SETTINGS as Settings,
// [app]
"app.name" => "PageTop Application",
"app.description" => "Developed with the amazing PageTop framework.",
"app.name" => "PageTop App",
"app.description" => "Modular web solutions made simple with PageTop.",
"app.theme" => "Basic",
"app.language" => "en-US",
"app.direction" => "ltr",

View file

@ -33,7 +33,7 @@ impl fmt::Display for FatalError {
let error_page = Page::new(request.clone());
if let Ok(page) = error_page
.with_title(L10n::text("Error FORBIDDEN"))
.with_this_in("content", error403::Error403)
.with_in("content", error403::Error403)
.with_template("error")
.render()
{
@ -47,7 +47,7 @@ impl fmt::Display for FatalError {
let error_page = Page::new(request.clone());
if let Ok(page) = error_page
.with_title(L10n::text("Error RESOURCE NOT FOUND"))
.with_this_in("content", error404::Error404)
.with_in("content", error404::Error404)
.with_template("error")
.render()
{

View file

@ -102,11 +102,7 @@ impl Page {
}
#[fn_builder]
pub fn alter_this_in(
&mut self,
region: &'static str,
component: impl ComponentTrait,
) -> &mut Self {
pub fn alter_in(&mut self, region: &'static str, component: impl ComponentTrait) -> &mut Self {
self.regions.add_to(region, component);
self
}

View file

@ -1,15 +0,0 @@
use pagetop::prelude::*;
struct HealthCheck;
impl ModuleTrait for HealthCheck {}
async fn spawn_app() {
let server = Application::prepare(&HealthCheck).unwrap().server();
let _ = actix_web::rt::spawn(server);
}
#[actix_web::test]
async fn health_check_works() {
spawn_app();
}

View file

@ -1 +0,0 @@
mod health_check;