浏览代码

fix tech description

Alexander Musikhin 20 小时之前
父节点
当前提交
6a202f2ef9
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 1 1
      resources/views/common_catalog/edit.blade.php
  2. 13 0
      tests/Feature/CommonCatalogControllerTest.php

+ 1 - 1
resources/views/common_catalog/edit.blade.php

@@ -230,7 +230,7 @@
                             <div class="alert alert-light border mb-0 mt-3 py-2">
                                 @if($canViewTechnicalDescriptionPrice)
                                     Цена для DOCX: <strong>{{ $technicalDescriptionPriceLabel }}</strong> —
-                                    <strong>{{ $item->{$technicalDescriptionPriceField.'_txt'} }}</strong>
+                                    <strong>{{ str_replace('&nbsp;', "\u{00A0}", $item->{$technicalDescriptionPriceField.'_txt'}) }}</strong>
                                 @else
                                     Цена для DOCX скрыта вашими правами доступа.
                                 @endif

+ 13 - 0
tests/Feature/CommonCatalogControllerTest.php

@@ -274,6 +274,19 @@ class CommonCatalogControllerTest extends TestCase
             ->assertSeeText('Калькуляция');
     }
 
+    public function test_technical_description_price_uses_a_non_breaking_space_instead_of_an_html_entity(): void
+    {
+        $item = CommonCatalogItem::factory()->create([
+            'project_price' => 434800,
+        ]);
+
+        $this->actingAs($this->admin)
+            ->get(route('common-catalog.show', $item))
+            ->assertOk()
+            ->assertSee("434\u{00A0}800.00₽", false)
+            ->assertDontSee('&amp;nbsp;', false);
+    }
+
     public function test_admin_can_edit_technical_description_fields(): void
     {
         $item = CommonCatalogItem::factory()->create();