From 3d82cd56848d37ac0f63e2876b96b6062e00915d Mon Sep 17 00:00:00 2001 From: Imran Hossain Date: Mon, 1 Jan 2024 14:06:58 +0600 Subject: [PATCH] change name of hasOutlineBlock function --- assets/js/admin/first-course-creation-notice.js | 10 +++++----- assets/js/admin/first-course-creation-notice.test.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/js/admin/first-course-creation-notice.js b/assets/js/admin/first-course-creation-notice.js index d204c4ac4c..0b4490d354 100644 --- a/assets/js/admin/first-course-creation-notice.js +++ b/assets/js/admin/first-course-creation-notice.js @@ -11,14 +11,14 @@ import { find as findObject } from 'lodash'; */ import { getFirstBlockByName } from '../../blocks/course-outline/data'; -export const hasOutlineBlock = () => +export const getOutlineBlock = () => getFirstBlockByName( 'sensei-lms/course-outline', select( 'core/block-editor' ).getBlocks() ); export const handleCourseOutlineBlockIncomplete = async () => { - let courseOutlineBlock = hasOutlineBlock(); + let courseOutlineBlock = getOutlineBlock(); // If the course outline block doesn't exist, create it and insert it. if ( ! courseOutlineBlock ) { @@ -142,8 +142,8 @@ export const handleFirstCourseCreationHelperNotice = () => { if ( noticeCreated && ! noticeRemoved && - hasOutlineBlock() && - hasLessonInOutline( [ hasOutlineBlock() ] ) + getOutlineBlock() && + hasLessonInOutline( [ getOutlineBlock() ] ) ) { noticeRemoved = true; noticeCreated = false; @@ -156,7 +156,7 @@ export const handleFirstCourseCreationHelperNotice = () => { ! noticeCreated && ! isFirstCourseNoticeDismissed && ! ( - hasOutlineBlock() && hasLessonInOutline( [ hasOutlineBlock() ] ) + getOutlineBlock() && hasLessonInOutline( [ getOutlineBlock() ] ) ) ) { noticeCreated = true; diff --git a/assets/js/admin/first-course-creation-notice.test.js b/assets/js/admin/first-course-creation-notice.test.js index 4a547eea77..011456e1a2 100644 --- a/assets/js/admin/first-course-creation-notice.test.js +++ b/assets/js/admin/first-course-creation-notice.test.js @@ -7,7 +7,7 @@ import { dispatch, select, subscribe } from '@wordpress/data'; * Internal dependencies */ import { - hasOutlineBlock, + getOutlineBlock, handleCourseOutlineBlockIncomplete, handleFirstCourseCreationHelperNotice, hasLessonInOutline, @@ -81,7 +81,7 @@ describe( 'handleCourseOutlineBlockIncomplete', () => { .handleCourseOutlineBlockIncomplete ); getFirstBlockByName.mockClear(); - hasOutlineBlock.mockClear(); + getOutlineBlock.mockClear(); createBlock.mockClear(); } ); it( 'should create and insert a block when no course outline block exists', () => {