diff --git a/src/components/DateTime.js b/src/components/DateTime.js
index 5b18295d8..450571838 100644
--- a/src/components/DateTime.js
+++ b/src/components/DateTime.js
@@ -20,6 +20,8 @@ import {
* Formats the provided start date and time according to the specified label format
* and returns the formatted result in the time zone configured for the plugin.
*
+ * @since 1.0.0
+ *
* @param {Object} props - The properties object containing the start date and time.
* @param {string} props.dateTimeStart - The start date and time to be formatted.
*
@@ -35,6 +37,8 @@ export const DateTimeStartLabel = (props) => {
* Formats the provided end date and time according to the specified label format
* and returns the formatted result in the time zone configured for the plugin.
*
+ * @since 1.0.0
+ *
* @param {Object} props - The properties object containing the end date and time.
* @param {string} props.dateTimeStart - The end date and time to be formatted.
*
diff --git a/src/components/EditCover.js b/src/components/EditCover.js
index 9a124844c..bc90fa220 100644
--- a/src/components/EditCover.js
+++ b/src/components/EditCover.js
@@ -1,6 +1,8 @@
/**
* EditCover component provides an overlay for content to indicate its editability.
*
+ * @since 1.0.0
+ *
* @param {Object} props - The properties passed to the component.
* @param {boolean} props.isSelected - Indicates whether the content is selected for editing.
* @param {JSX.Element} props.children - The child elements to be rendered within the component.
diff --git a/src/components/MapEmbed.js b/src/components/MapEmbed.js
index 2916ccadc..cea748242 100644
--- a/src/components/MapEmbed.js
+++ b/src/components/MapEmbed.js
@@ -1,6 +1,8 @@
/**
* MapEmbed component renders an embedded Google Map based on provided location and settings.
*
+ * @since 1.0.0
+ *
* @param {number} props - The properties passed to the component.
* @param {string} props.location - The location to be displayed on the map (address or coordinates).
* @param {number} [props.zoom=1] - The zoom level of the map.
diff --git a/src/components/OnlineEvent.js b/src/components/OnlineEvent.js
index d9b3ca6cd..0cf17e4aa 100644
--- a/src/components/OnlineEvent.js
+++ b/src/components/OnlineEvent.js
@@ -15,6 +15,16 @@ import { useState } from '@wordpress/element';
import { Listener } from '../helpers/broadcasting';
import { getFromGlobal } from '../helpers/globals';
+/**
+ * OnlineEvent component displays information about an online event and provides a link to the event if available.
+ *
+ * @since 1.0.0
+ *
+ * @param {Object} props - The properties passed to the component.
+ * @param {string} [props.onlineEventLinkDefault=''] - The default link for the online event.
+ *
+ * @return {JSX.Element} The rendered OnlineEvent component.
+ */
const OnlineEvent = ({ onlineEventLinkDefault = '' }) => {
const text = __('Online event', 'gatherpress');
const [onlineEventLink, setOnlineEventLink] = useState(
diff --git a/src/helpers/broadcasting.js b/src/helpers/broadcasting.js
index 2a17a468d..45f82632d 100644
--- a/src/helpers/broadcasting.js
+++ b/src/helpers/broadcasting.js
@@ -1,6 +1,8 @@
/**
* Broadcasts custom events based on the provided payload, optionally appending an identifier to each event type.
*
+ * @since 1.0.0
+ *
* @param {Object} payload - An object containing data to be dispatched with custom events.
* @param {string} identifier - An optional identifier to append to each event type.
*
@@ -26,6 +28,8 @@ export const Broadcaster = (payload, identifier = '') => {
* Sets up event listeners for custom events based on the provided payload, optionally appending an identifier to each event type.
* When an event is triggered, the corresponding listener callback is executed with the event detail.
*
+ * @since 1.0.0
+ *
* @param {Object} payload - An object specifying event types and their corresponding listener callbacks.
* @param {string} identifier - An optional identifier to append to each event type.
*
diff --git a/src/helpers/datetime.js b/src/helpers/datetime.js
index c4429cac6..f75a8029f 100644
--- a/src/helpers/datetime.js
+++ b/src/helpers/datetime.js
@@ -25,6 +25,8 @@ export const dateTimeLabelFormat = 'MMMM D, YYYY h:mm a';
* Retrieves the timezone for the application based on the provided timezone or the global setting.
* If the provided timezone is invalid, the default timezone is set to 'GMT'.
*
+ * @since 1.0.0
+ *
* @param {string} timezone - The timezone to be used, defaults to the global setting 'event_datetime.timezone'.
*
* @return {string} The retrieved timezone, or 'GMT' if the provided timezone is invalid.
@@ -43,6 +45,8 @@ export const getTimeZone = (
* Retrieves the UTC offset for a given timezone.
* If the timezone is not set to 'GMT', an empty string is returned.
*
+ * @since 1.0.0
+ *
* @param {string} timezone - The timezone for which to retrieve the UTC offset.
*
* @return {string} UTC offset without the colon if the timezone is set to 'GMT', otherwise an empty string.
@@ -63,6 +67,8 @@ export const getUtcOffset = (timezone) => {
* Converts a UTC offset string to a format suitable for display,
* removing the colon (:) between hours and minutes.
*
+ * @since 1.0.0
+ *
* @param {string} offset - The UTC offset string to be converted.
*
* @return {string} Converted UTC offset without the colon, suitable for display.
@@ -76,6 +82,8 @@ export const maybeConvertUtcOffsetForDisplay = (offset = '') => {
* The function accepts offsets in the form of 'UTC+HH:mm', 'UTC-HH:mm', 'UTC+HH', or 'UTC-HH'.
* The resulting format is '+HH:mm' or '-HH:mm'.
*
+ * @since 1.0.0
+ *
* @param {string} offset - The UTC offset string to be converted.
*
* @return {string} Converted UTC offset in the format '+HH:mm' or '-HH:mm'.
@@ -108,6 +116,8 @@ export const maybeConvertUtcOffsetForDatabase = (offset = '') => {
* Converts a UTC offset string to a format suitable for dropdown selection,
* specifically in the format '+HH:mm' or '-HH:mm'.
*
+ * @since 1.0.0
+ *
* @param {string} offset - The UTC offset string to be converted.
*
* @return {string} Converted UTC offset in the format '+HH:mm' or '-HH:mm'.
@@ -136,6 +146,8 @@ export const maybeConvertUtcOffsetForSelect = (offset = '') => {
* The default start date and time for an event.
* It is set to the current date and time plus one day at 18:00:00 in the application's timezone.
*
+ * @since 1.0.0
+ *
* @type {string} Formatted default start date and time in the application's timezone.
*/
export const defaultDateTimeStart = moment
@@ -150,6 +162,8 @@ export const defaultDateTimeStart = moment
* The default end date and time for an event.
* It is calculated based on the default start date and time plus two hours in the application's timezone.
*
+ * @since 1.0.0
+ *
* @type {string} Formatted default end date and time in the application's timezone.
*/
export const defaultDateTimeEnd = moment
@@ -162,6 +176,8 @@ export const defaultDateTimeEnd = moment
* If the start date and time is not set, it defaults to a predefined value.
* The formatted datetime is then stored in the global settings for future access.
*
+ * @since 1.0.0
+ *
* @return {string} The formatted start date and time for the event.
*/
export const getDateTimeStart = () => {
@@ -182,6 +198,8 @@ export const getDateTimeStart = () => {
* If the end date and time is not set, it defaults to a predefined value.
* The formatted datetime is then stored in the global settings for future access.
*
+ * @since 1.0.0
+ *
* @return {string} The formatted end date and time for the event.
*/
export const getDateTimeEnd = () => {
@@ -200,6 +218,8 @@ export const getDateTimeEnd = () => {
/**
* Updates the start date and time for an event, performs validation, and triggers the save functionality.
*
+ * @since 1.0.0
+ *
* @param {string} date - The new start date and time to be set.
* @param {Function} setDateTimeStart - Optional callback function to update the state or perform additional actions.
*
diff --git a/test/unit/js/src/components/OnlineEvent.test.js b/test/unit/js/src/components/OnlineEvent.test.js
new file mode 100644
index 000000000..786375da8
--- /dev/null
+++ b/test/unit/js/src/components/OnlineEvent.test.js
@@ -0,0 +1,39 @@
+/**
+ * External dependencies.
+ */
+import { render } from '@testing-library/react';
+import { expect, test } from '@jest/globals';
+import '@testing-library/jest-dom';
+
+/**
+ * Internal dependencies.
+ */
+import OnlineEvent from '../../../../../src/components/OnlineEvent';
+
+/**
+ * Coverage for OnlineEvent.
+ */
+test('OnlineEvent renders component without link', () => {
+ const { container } = render();
+
+ expect(container).toHaveTextContent('Online event');
+ expect(container.children[0].children[0].children[0]).toHaveClass(
+ 'dashicon dashicons dashicons-video-alt2'
+ );
+ expect(container.children[0].children[1].children[0]).toHaveClass(
+ 'gp-tooltip'
+ );
+});
+
+test('OnlineEvent renders component with link', () => {
+ const link = 'https://unit.test/chat/';
+ const { container } = render();
+
+ expect(container).toHaveTextContent('Online event');
+ expect(container.children[0].children[0].children[0]).toHaveClass(
+ 'dashicon dashicons dashicons-video-alt2'
+ );
+ expect(
+ container.children[0].children[1].children[0].getAttribute('href')
+ ).toBe(link);
+});