Skip to content

Commit

Permalink
Fix JSDoc comments for jest helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Oct 12, 2022
1 parent f9454c3 commit 7617d26
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions lib/jest-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const nunjucksEnv = nunjucks.configure([configPaths.src, configPaths.components]
/**
* Render the raw HTML for a component
*
* @param {String} componentName
* @param {Object} options options to pass to the component macro
* @param {String} [callBlock] if provided, the macro is called using the
* @param {string} componentName
* @param {object} options - options to pass to the component macro
* @param {string} [callBlock] - if provided, the macro is called using the
* Nunjucks call tag, with the callBlock passed as the contents of the block
* @returns {String} HTML rendered by the macro
* @returns {string} HTML rendered by the macro
*/
function renderHtml (componentName, options, callBlock = false) {
if (typeof options === 'undefined') {
Expand Down Expand Up @@ -52,12 +52,11 @@ function renderHtml (componentName, options, callBlock = false) {
*
* Allows us to interrogate the output of the macro using a jQuery-like syntax
*
* @param {String} componentName
* @param {Object} options options to pass to the component macro
* @param {String} [callBlock] if provided, the macro is called using the
* @param {string} componentName
* @param {object} options - options to pass to the component macro
* @param {string} [callBlock] - if provided, the macro is called using the
* Nunjucks call tag, with the callBlock passed as the contents of the block
*
* @returns {CheerioAPI} a jQuery-like representation of the macro output
* @returns {import('cheerio')} a jQuery-like representation of the macro output
*/
function render (componentName, options, callBlock = false) {
return cheerio.load(
Expand All @@ -82,6 +81,7 @@ function renderTemplate (params = {}, blocks = {}) {

/**
* Get examples from a component's metadata file
*
* @param {string} componentName
* @returns {object} returns object that includes all examples at once
*/
Expand All @@ -100,8 +100,8 @@ async function getExamples (componentName) {
/**
* Render Sass
*
* @param {object} options Options to pass to sass.render
* @return {promise} Result of calling sass.render
* @param {import('node-sass').Options} options - Options to pass to sass.render
* @returns {Promise<import('node-sass').Result>} Result of calling sass.render
*/
function renderSass (options) {
return sassRender({
Expand All @@ -115,9 +115,10 @@ function renderSass (options) {
* child elements that do not match the component.
* Relies on B.E.M naming ensuring that child components relating to a component
* are namespaced.
* @param {function} $ requires an instance of cheerio (jQuery) that includes the
*
* @param {import('cheerio')} $ - requires an instance of cheerio (jQuery) that includes the
* rendered component.
* @param {string} className the top level class 'Block' in B.E.M terminology
* @param {string} className - the top level class 'Block' in B.E.M terminology
* @returns {string} returns HTML
*/
function htmlWithClassName ($, className) {
Expand Down

0 comments on commit 7617d26

Please sign in to comment.