Skip to content

Commit

Permalink
Typography Tests (#207)
Browse files Browse the repository at this point in the history
* added tests for typography

* added a delay so that the option is saved correctly

added a 1 second delay so that the selected font option has time to be saved to the database before the browser is closed

* Replaced the font Abel with Inter

* fixed timeout function: changed to playwright api used

* remove unused fonts provider

* added quotes to font family names

---------

Co-authored-by: Nikita <[email protected]>
  • Loading branch information
Fellan-91 and nk-o authored Feb 26, 2024
1 parent 722b32d commit 5cc021b
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 383 deletions.
1 change: 0 additions & 1 deletion class-ghost-kit.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public function init_options() {
require_once $this->plugin_path . 'classes/3rd/class-page-builder-framework.php';
require_once $this->plugin_path . 'classes/3rd/class-blocksy.php';
require_once $this->plugin_path . 'classes/3rd/class-rank-math.php';
require_once $this->plugin_path . 'classes/google-fonts/class-fonts-google-provider.php';

// Migration.
require_once $this->plugin_path . 'classes/class-migration.php';
Expand Down
5 changes: 4 additions & 1 deletion classes/class-typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ public static function generate_typography_styles() {
$typography_styles .= $output['selectors'] . '{';

if ( self::is_exist( $typography_prepeare_style['style-properties'], 'font-family' ) ) {
$typography_styles .= 'font-family: ' . esc_attr( $typography_prepeare_style['style-properties']['font-family'] ) . ', sans-serif;';
// Add double quotes to the font name, because some fonts have a space in the name.
// And if the font name is not in quotes, then the browser will not be able to find it.
// For example font-family: Source Serif 4; - will not work.
$typography_styles .= 'font-family: "' . esc_attr( $typography_prepeare_style['style-properties']['font-family'] ) . '", sans-serif;';
}

if ( self::is_exist( $typography_prepeare_style['style-properties'], 'font-size' ) ) {
Expand Down
Loading

0 comments on commit 5cc021b

Please sign in to comment.