Skip to content

Commit 88e1e15

Browse files
fsecada01claude
andcommitted
test: integration test apps — FastAPI Jinja2 gallery and Django Cotton gallery
- Add FastAPI/JinjaX integration app (tests/integration/jinja_app/main.py) with endpoints for form-field, modal, card, navbar, tabs, and gallery - Add Django/Cotton integration app (tests/integration/cotton_app/) with settings, URLs, views, and gallery templates using <c-cf.*> Cotton components - Add 5 Jinja2 integration tests and 3 Cotton integration tests; all 101 tests pass - Fix JinjaX Catalog compatibility: rename `class` → `extra_class` and `error=none` → `error=""` in all 14 Jinja2 templates to avoid Python keyword/parser conflicts - Fix fastapi.install_cf_ui to use catalog.add_folder() (add_path does not exist) - Add tests/integration/conftest.py to isolate Django setup from unit conftest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6aeb546 commit 88e1e15

32 files changed

Lines changed: 336 additions & 78 deletions

src/cf_ui/fastapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def install_cf_ui(catalog: Any, theme: str = "bulma") -> None:
1111
theme: CSS framework theme name. Defaults to "bulma".
1212
"""
1313
template_dir = JINJA_TEMPLATES_DIR / theme
14-
catalog.add_path(template_dir, prefix="Cf")
14+
catalog.add_folder(template_dir, prefix="Cf")

src/cf_ui/templates/jinja/bulma/Breadcrumb.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{#def items=[], class="" #}
1+
{#def items=[], extra_class="" #}
22
{% set items = items if items is defined else [] %}
3-
<nav class="breadcrumb {{ class }}" aria-label="breadcrumbs">
3+
<nav class="breadcrumb {{ extra_class }}" aria-label="breadcrumbs">
44
<ul>
55
{% for item in items %}
66
<li{% if loop.last %} class="is-active"{% endif %}>

src/cf_ui/templates/jinja/bulma/Card.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{#def content="", header="", footer="", class="" #}
1+
{#def content="", header="", footer="", extra_class="" #}
22
{% set header = header if header is defined else "" %}
33
{% set content = content if content is defined else "" %}
44
{% set footer = footer if footer is defined else "" %}
5-
<div class="card {{ class }}">
5+
<div class="card {{ extra_class }}">
66
{% if header %}
77
<header class="card-header">
88
<p class="card-header-title">{{ header }}</p>

src/cf_ui/templates/jinja/bulma/CheckboxGroup.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{#def name, label, choices=[], selected=[], error=none, class="" #}
2-
<div class="field {{ class }}">
1+
{#def name, label, choices=[], selected=[], error="", extra_class="" #}
2+
<div class="field {{ extra_class }}">
33
<label class="label">{{ label }}</label>
44
<div class="control">
55
{% for choice in choices %}

src/cf_ui/templates/jinja/bulma/FormField.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{#def name, label, value="", error=none, type="text", required=false, class="" #}
2-
<div class="field {{ class }}">
1+
{#def name, label, value="", error="", type="text", required=false, extra_class="" #}
2+
<div class="field {{ extra_class }}">
33
<label class="label" for="{{ name }}">{{ label }}</label>
44
<div class="control">
55
<input class="input{% if error %} is-danger{% endif %}"

src/cf_ui/templates/jinja/bulma/Modal.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{#def id="modal", header="", content="", footer="", class="" #}
1+
{#def id="modal", header="", content="", footer="", extra_class="" #}
22
{% set header = header if header is defined else "" %}
33
{% set content = content if content is defined else "" %}
44
{% set footer = footer if footer is defined else "" %}
55
<div id="{{ id }}"
6-
class="modal {{ class }}"
6+
class="modal {{ extra_class }}"
77
x-data="cfModal"
88
x-init="initModal()"
99
:class="{ 'is-active': open }">

src/cf_ui/templates/jinja/bulma/Navbar.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{#def brand="", start="", end="", class="" #}
1+
{#def brand="", start="", end="", extra_class="" #}
22
{% set brand = brand if brand is defined else "" %}
33
{% set start = start if start is defined else "" %}
44
{% set end = end if end is defined else "" %}
5-
<nav class="navbar {{ class }}" role="navigation" aria-label="main navigation"
5+
<nav class="navbar {{ extra_class }}" role="navigation" aria-label="main navigation"
66
x-data="cfNavbar">
77
<div class="navbar-brand">
88
{{ brand }}

src/cf_ui/templates/jinja/bulma/Notification.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{#def message, type="info", dismissible=true, class="" #}
2-
<div class="notification is-{{ type }} {{ class }}"
1+
{#def message, type="info", dismissible=true, extra_class="" #}
2+
<div class="notification is-{{ type }} {{ extra_class }}"
33
x-data="{ visible: true }"
44
x-show="visible">
55
{% if dismissible %}

src/cf_ui/templates/jinja/bulma/Pagination.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{#def page=1, total_pages=1, hx_target="", hx_url="", class="" #}
1+
{#def page=1, total_pages=1, hx_target="", hx_url="", extra_class="" #}
22
{% set page = page if page is defined else 1 %}
33
{% set total_pages = total_pages if total_pages is defined else 1 %}
4-
<nav class="pagination is-centered {{ class }}" role="navigation" aria-label="pagination">
4+
<nav class="pagination is-centered {{ extra_class }}" role="navigation" aria-label="pagination">
55
{% if page > 1 %}
66
<a class="pagination-previous"
77
hx-get="{{ hx_url }}?page={{ page - 1 }}"

src/cf_ui/templates/jinja/bulma/Panel.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{#def title, content="", open=false, class="" #}
1+
{#def title, content="", open=false, extra_class="" #}
22
{% set content = content if content is defined else "" %}
3-
<div class="card {{ class }}" x-data="cfPanel">
3+
<div class="card {{ extra_class }}" x-data="cfPanel">
44
<header class="card-header" style="cursor:pointer" @click="open = !open">
55
<p class="card-header-title">{{ title }}</p>
66
<button class="card-header-icon" aria-label="toggle panel">

0 commit comments

Comments
 (0)