rename postfix param to suffix (#10667)
This commit is contained in:
@@ -235,7 +235,7 @@ function rangeStart(v) {
|
|||||||
* @param {string} [options.tag] - The tag to display on the badge, such as "alpha" or "beta"
|
* @param {string} [options.tag] - The tag to display on the badge, such as "alpha" or "beta"
|
||||||
* @param {string} [options.defaultLabel] - The default label to display on the badge, such as "npm" or "github"
|
* @param {string} [options.defaultLabel] - The default label to display on the badge, such as "npm" or "github"
|
||||||
* @param {string} [options.prefix] - The prefix to display on the message, such as ">=", "v", overrides the default behavior of using addv
|
* @param {string} [options.prefix] - The prefix to display on the message, such as ">=", "v", overrides the default behavior of using addv
|
||||||
* @param {string} [options.postfix] - The postfix to display on the message, such as "tested"
|
* @param {string} [options.suffix] - The suffix to display on the message, such as "tested"
|
||||||
* @param {Function} [options.versionFormatter=versionColor] - The function to use to format the color of the badge based on the version number
|
* @param {Function} [options.versionFormatter=versionColor] - The function to use to format the color of the badge based on the version number
|
||||||
* @param {boolean} [options.isPrerelease] - Whether the version is explicitly marked as a prerelease by upstream API
|
* @param {boolean} [options.isPrerelease] - Whether the version is explicitly marked as a prerelease by upstream API
|
||||||
* @returns {object} A badge object that has three properties: label, message, and color
|
* @returns {object} A badge object that has three properties: label, message, and color
|
||||||
@@ -249,7 +249,7 @@ function renderVersionBadge({
|
|||||||
tag,
|
tag,
|
||||||
defaultLabel,
|
defaultLabel,
|
||||||
prefix,
|
prefix,
|
||||||
postfix,
|
suffix,
|
||||||
versionFormatter = versionColor,
|
versionFormatter = versionColor,
|
||||||
isPrerelease,
|
isPrerelease,
|
||||||
}) {
|
}) {
|
||||||
@@ -257,7 +257,7 @@ function renderVersionBadge({
|
|||||||
label: tag ? `${defaultLabel}@${tag}` : defaultLabel,
|
label: tag ? `${defaultLabel}@${tag}` : defaultLabel,
|
||||||
message:
|
message:
|
||||||
(prefix ? `${prefix}${version}` : addv(version)) +
|
(prefix ? `${prefix}${version}` : addv(version)) +
|
||||||
(postfix ? ` ${postfix}` : ''),
|
(suffix ? ` ${suffix}` : ''),
|
||||||
color: versionFormatter(isPrerelease ? 'pre' : version),
|
color: versionFormatter(isPrerelease ? 'pre' : version),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ describe('Version helpers', function () {
|
|||||||
message: 'v1.2.3',
|
message: 'v1.2.3',
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
})
|
})
|
||||||
given({ version: '1.2.3', postfix: 'tested' }).expect({
|
given({ version: '1.2.3', suffix: 'tested' }).expect({
|
||||||
label: undefined,
|
label: undefined,
|
||||||
message: 'v1.2.3 tested',
|
message: 'v1.2.3 tested',
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
@@ -164,7 +164,7 @@ describe('Version helpers', function () {
|
|||||||
version: '1.2.3',
|
version: '1.2.3',
|
||||||
tag: 'beta',
|
tag: 'beta',
|
||||||
defaultLabel: 'github',
|
defaultLabel: 'github',
|
||||||
postfix: 'tested',
|
suffix: 'tested',
|
||||||
}).expect({
|
}).expect({
|
||||||
label: 'github@beta',
|
label: 'github@beta',
|
||||||
message: 'v1.2.3 tested',
|
message: 'v1.2.3 tested',
|
||||||
@@ -197,7 +197,7 @@ describe('Version helpers', function () {
|
|||||||
given({
|
given({
|
||||||
version: '1.2.3',
|
version: '1.2.3',
|
||||||
prefix: '^',
|
prefix: '^',
|
||||||
postfix: 'tested',
|
suffix: 'tested',
|
||||||
}).expect({
|
}).expect({
|
||||||
label: undefined,
|
label: undefined,
|
||||||
message: '^1.2.3 tested',
|
message: '^1.2.3 tested',
|
||||||
@@ -208,7 +208,7 @@ describe('Version helpers', function () {
|
|||||||
tag: 'beta',
|
tag: 'beta',
|
||||||
defaultLabel: 'github',
|
defaultLabel: 'github',
|
||||||
prefix: '^',
|
prefix: '^',
|
||||||
postfix: 'tested',
|
suffix: 'tested',
|
||||||
}).expect({
|
}).expect({
|
||||||
label: 'github@beta',
|
label: 'github@beta',
|
||||||
message: '^1.2.3 tested',
|
message: '^1.2.3 tested',
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class WordpressPluginTestedVersion extends BaseWordpress {
|
|||||||
const color = await versionColorForWordpressVersion(testedVersion)
|
const color = await versionColorForWordpressVersion(testedVersion)
|
||||||
return renderVersionBadge({
|
return renderVersionBadge({
|
||||||
version: testedVersion,
|
version: testedVersion,
|
||||||
postfix: 'tested',
|
suffix: 'tested',
|
||||||
versionFormatter: () => color,
|
versionFormatter: () => color,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user