diff --git a/packages/server-renderer/__tests__/renderAttrs.spec.ts b/packages/server-renderer/__tests__/renderAttrs.spec.ts index de958848..54ac2cea 100644 --- a/packages/server-renderer/__tests__/renderAttrs.spec.ts +++ b/packages/server-renderer/__tests__/renderAttrs.spec.ts @@ -1,10 +1,12 @@ import { renderAttrs, renderClass, - renderStyle + renderStyle, + renderAttr } from '../src/helpers/renderAttrs' +import { escapeHtml } from '@vue/shared' -describe('ssr: renderProps', () => { +describe('ssr: renderAttrs', () => { test('ignore reserved props', () => { expect( renderAttrs({ @@ -72,6 +74,23 @@ describe('ssr: renderProps', () => { }) }) +describe('ssr: renderAttr', () => { + test('basic', () => { + expect(renderAttr('foo', 'bar')).toBe(` foo="bar"`) + }) + + test('null and undefined', () => { + expect(renderAttr('foo', null)).toBe(``) + expect(renderAttr('foo', undefined)).toBe(``) + }) + + test('escape', () => { + expect(renderAttr('foo', '