@wordpress/e2e-test-utils
Version:
End-To-End (E2E) test utils for WordPress.
19 lines (18 loc) • 600 B
JavaScript
/* wp:polyfill */
/**
* Internal dependencies
*/
import { createURL } from './create-url';
/**
* Checks if current URL is a WordPress path.
*
* @param {string} WPPath String to be serialized as pathname.
* @param {?string} query String to be serialized as query portion of URL.
* @return {boolean} Boolean represents whether current URL is or not a WordPress path.
*/
export function isCurrentURL(WPPath, query = '') {
const currentURL = new URL(page.url());
currentURL.search = query;
return createURL(WPPath, query) === currentURL.href;
}
//# sourceMappingURL=is-current-url.js.map