From 08d7c48dc762610360873cc516adf9ffd62430f7 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 9 Aug 2022 18:49:14 +0530 Subject: [PATCH] refactor: use browser native lazy loading (#31814) --- .../doctype/homepage_section/test_homepage_section.py | 6 +++++- erpnext/templates/includes/macros.html | 2 +- erpnext/templates/pages/home.html | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/portal/doctype/homepage_section/test_homepage_section.py b/erpnext/portal/doctype/homepage_section/test_homepage_section.py index 27b0169c59..27c8fe4c95 100644 --- a/erpnext/portal/doctype/homepage_section/test_homepage_section.py +++ b/erpnext/portal/doctype/homepage_section/test_homepage_section.py @@ -57,7 +57,11 @@ class TestHomepageSection(unittest.TestCase): self.assertEqual(cards[0].h5.text, "Card 1") self.assertEqual(cards[0].a["href"], "/card-1") self.assertEqual(cards[1].p.text, "Subtitle 2") - self.assertEqual(cards[1].find(class_="website-image-lazy")["data-src"], "test.jpg") + + img = cards[1].find(class_="card-img-top") + + self.assertEqual(img["src"], "test.jpg") + self.assertEqual(img["loading"], "lazy") # cleanup frappe.db.rollback() diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html index 3e20e50c3d..f56dc3a454 100644 --- a/erpnext/templates/includes/macros.html +++ b/erpnext/templates/includes/macros.html @@ -46,7 +46,7 @@
{% if card.image %} -
+ {{ card.title }} {% endif %}
{{ card.title }}
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html index 4c69b8388d..27d966ad42 100644 --- a/erpnext/templates/pages/home.html +++ b/erpnext/templates/pages/home.html @@ -37,7 +37,7 @@ {% for item in homepage.products %}
-
+ {{ item.item_name }}
{{ item.item_name }}
{{ _('More details') }}