Skip to content

Commit 8621af7

Browse files
build: Merged bug/CS-43011-dependency-issue into next
2 parents b1f9505 + 8c3ca17 commit 8621af7

File tree

5 files changed

+38
-21
lines changed

5 files changed

+38
-21
lines changed

__test__/default-options.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { entryContentBlank, entryContentURL, entryContentTitle, entryContentTitl
44
import { RenderItem } from '../src/options/index';
55
import { assetContentBlank,
66
assetContentUrl,
7+
assetContentWithoutTitleAndUID,
78
assetContentonlyFileName,
89
assetContentonlyFileNameAndURL,
910
assetContentonlyTitle,
@@ -93,6 +94,11 @@ describe('Default Option test', () => {
9394
done()
9495
})
9596

97+
it('Default options Asset with uid, url and filename test', done => {
98+
expect(assetDownloadFunction(assetContentWithoutTitleAndUID, embedAttributes)).toEqual(`<a href="${assetContentWithoutTitleAndUID.url}">${assetContentWithoutTitleAndUID.system.content_type_uid}</a>`)
99+
done()
100+
})
101+
96102
it('Default options Link text test', done => {
97103
expect(entryLinkFunction(entryContentURL, embedAttributesText)).toEqual(`<a href="${entryContentURL.url}">${linkText}</a>`)
98104
expect(entryLinkFunction(entryContentTitle, embedAttributesText)).toEqual(`<a href="undefined">${linkText}</a>`)

__test__/mock/asset-mock.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,13 @@ export const assetContentonlyTitleAndUrl = {
3333
title: "title",
3434
url: "url",
3535
_content_type_uid: 'sys_assets'
36+
}
37+
38+
export const assetContentWithoutTitleAndUID = {
39+
url: "url",
40+
_content_type_uid: 'sys_assets',
41+
system: {
42+
uid: 'sys_uid',
43+
content_type_uid: 'ct_uid'
44+
}
3645
}

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@
3636
"author": "Contentstack",
3737
"license": "MIT",
3838
"devDependencies": {
39-
"@babel/preset-env": "^7.16.11",
40-
"@commitlint/cli": "^17.4.2",
41-
"@commitlint/config-conventional": "^17.4.2",
39+
"@babel/preset-env": "^7.22.20",
40+
"@commitlint/cli": "^17.7.1",
41+
"@commitlint/config-conventional": "^17.7.0",
4242
"@types/jest": "^26.0.24",
4343
"babel-core": "^4.7.16",
4444
"babel-jest": "^29.7.0",
4545
"babel-loader": "8.1.0",
4646
"babel-preset-es2015": "^6.24.1",
4747
"commitizen": "^4.3.0",
48-
"eslint": "^8.12.0",
48+
"eslint": "^8.50.0",
4949
"husky": "^8.0.3",
5050
"jest": "^29.7.0",
51-
"jest-coverage-badges": "^1.0.0",
5251
"jest-environment-jsdom": "^29.7.0",
52+
"jest-coverage-badges": "^1.1.2",
5353
"jest-html-reporters": "^2.1.7",
5454
"jest-junit": "^15.0.0",
55-
"jsdom": "^21.1.0",
55+
"jsdom": "^21.1.2",
5656
"jsdom-global": "^3.0.2",
57-
"prettier": "^2.6.1",
58-
"rollup": "^2.70.1",
57+
"prettier": "^2.8.8",
58+
"rollup": "^2.79.1",
5959
"rollup-plugin-json": "^4.0.0",
6060
"rollup-plugin-node-resolve": "^5.2.0",
6161
"rollup-plugin-sourcemaps": "^0.6.3",
@@ -64,7 +64,7 @@
6464
"ts-node": "^10.9.1",
6565
"tslint": "^6.1.3",
6666
"tslint-config-prettier": "^1.18.0",
67-
"typescript": "^4.6.3"
67+
"typescript": "^4.9.5"
6868
},
6969
"config": {
7070
"commitizen": {

src/options/default-node-options.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const defaultNodeOption: RenderOption = {
8181
},
8282

8383
['reference']:(node: Node, next: Next) => {
84-
if (node.attrs['type'] === 'asset') {
84+
if (node.attrs.type === 'asset') {
8585
return `<img${addStyleAttrs(node.attrs.style)} src="${node.attrs['asset-link']}" />`
8686
}
8787
return ``
@@ -121,8 +121,10 @@ export default function addStyleAttrs(styleObj: { [key: string]: any }) {
121121
if (!styleObj) return '';
122122
let styleString: string = '';
123123
for (const key in styleObj) {
124-
const value = styleObj[key];
125-
styleString += `${key}:${value};`;
124+
if (styleObj.hasOwnProperty(key)) {
125+
const value = styleObj[key];
126+
styleString += `${key}:${value};`;
127+
}
126128
}
127129
return ` style="${styleString}"`
128130
}

0 commit comments

Comments
 (0)