diff --git a/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/BankAccount.json b/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/BankAccount.json index 3ceca5f144c2..48c2dc9d6e97 100644 --- a/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/BankAccount.json +++ b/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/BankAccount.json @@ -17,7 +17,8 @@ { "fieldName": "active", "fieldType": "Boolean" }, { "fieldName": "accountType", "fieldType": "BankAccountType", "fieldValues": "CHECKING,SAVINGS,LOAN" }, { "fieldName": "attachment", "fieldType": "byte[]", "fieldTypeBlobContent": "any" }, - { "fieldName": "description", "fieldType": "byte[]", "fieldTypeBlobContent": "text" } + { "fieldName": "description", "fieldType": "byte[]", "fieldTypeBlobContent": "text" }, + { "fieldName": "metadata", "fieldType": "byte[]", "fieldTypeBlobContent": "json" } ], "fluentMethods": true, "jpaMetamodelFiltering": true, diff --git a/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/MicroserviceBankAccount.json b/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/MicroserviceBankAccount.json index 033940e176a1..366b38ff8e72 100644 --- a/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/MicroserviceBankAccount.json +++ b/.blueprint/generate-sample/templates/test-integration/samples/.jhipster/MicroserviceBankAccount.json @@ -13,7 +13,8 @@ { "fieldName": "active", "fieldType": "Boolean" }, { "fieldName": "accountType", "fieldType": "BankAccountType", "fieldValues": "CHECKING,SAVINGS,LOAN" }, { "fieldName": "attachment", "fieldType": "byte[]", "fieldTypeBlobContent": "any" }, - { "fieldName": "description", "fieldType": "byte[]", "fieldTypeBlobContent": "text" } + { "fieldName": "description", "fieldType": "byte[]", "fieldTypeBlobContent": "text" }, + { "fieldName": "metadata", "fieldType": "byte[]", "fieldTypeBlobContent": "json" } ], "fluentMethods": true, "jpaMetamodelFiltering": true, diff --git a/generators/angular/generator.spec.ts b/generators/angular/generator.spec.ts index 64bcf76b5961..8c9b1444ddc5 100644 --- a/generators/angular/generator.spec.ts +++ b/generators/angular/generator.spec.ts @@ -2,6 +2,7 @@ import { before, describe, expect, it } from 'esmocha'; import { basename } from 'node:path'; import { clientFrameworkTypes } from '../../lib/jhipster/index.ts'; +import type { Entity } from '../../lib/jhipster/types/entity.ts'; import { buildClientSamples, defaultHelpers as helpers, @@ -18,6 +19,11 @@ const generator = basename(import.meta.dirname); const { ANGULAR: clientFramework } = clientFrameworkTypes; const commonConfig = { clientFramework, nativeLanguage: 'en', languages: ['fr' as const, 'en' as const] }; +const jsonBlobEntity = { + name: 'JsonBlob', + changelogDate: '20220129025419', + fields: [{ fieldName: 'payload', fieldType: 'byte[]', fieldTypeBlobContent: 'json' }], +} satisfies Entity; const testSamples = buildClientSamples(commonConfig); @@ -231,4 +237,23 @@ describe(`generator - ${clientFramework}`, () => { expect(runResult.getSnapshot('**/entities/admin/user-management/**')).toMatchSnapshot(); }); }); + + describe('json blob content type', () => { + before(async () => { + await helpers + .runJHipster(generator) + .withJHipsterConfig({ ...commonConfig, applicationType: 'monolith', authenticationType: 'jwt' }, [jsonBlobEntity]) + .withSharedApplication({ gatewayServicesApiAvailable: false }) + .withSharedApplication({ getWebappTranslation: () => 'translations' }) + .withMockedSource() + .withMockedGenerators(['jhipster:common', 'jhipster:client:i18n']); + }); + + it('should render json blobs as textarea inputs', () => { + const updateFile = `${CLIENT_MAIN_SRC_DIR}app/entities/json-blob/update/json-blob-update.html`; + runResult.assertFileContent(updateFile, 'name="payload" id="field_payload" data-cy="payload"'); + runResult.assertFileContent(updateFile, '