From cff67c6db04a7aafb9c092fe18f8ec499e93e0be Mon Sep 17 00:00:00 2001 From: Adam Boro Date: Tue, 29 Sep 2020 19:24:49 +0200 Subject: [PATCH] fix: scroll-triggered popups (#232) Closes #217 Closes #231 --- includes/class-newspack-popups-inserter.php | 4 +- includes/class-newspack-popups-model.php | 5 +- tests/test-insertion.php | 24 ----- tests/test-model.php | 97 +++++++++++++++++++++ 4 files changed, 100 insertions(+), 30 deletions(-) create mode 100644 tests/test-model.php diff --git a/includes/class-newspack-popups-inserter.php b/includes/class-newspack-popups-inserter.php index f318905c..31502939 100644 --- a/includes/class-newspack-popups-inserter.php +++ b/includes/class-newspack-popups-inserter.php @@ -419,9 +419,7 @@ public static function register_amp_scripts() { public static function assess_is_post( $popup ) { if ( // Inline Pop-ups can only appear in Posts. - 'inline' === $popup['options']['placement'] || - // Pop-ups triggered by scroll position can only appear on Posts. - 'scroll' === $popup['options']['trigger_type'] + 'inline' === $popup['options']['placement'] ) { return is_single(); } diff --git a/includes/class-newspack-popups-model.php b/includes/class-newspack-popups-model.php index 690adfee..467ad3a8 100644 --- a/includes/class-newspack-popups-model.php +++ b/includes/class-newspack-popups-model.php @@ -788,9 +788,8 @@ function ( $evts ) use ( $popup, $body, $element_id ) { -
- -
+
+