diff --git a/.gitignore b/.gitignore index c9b9f6b..3e92faf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules/ -.DS_STORE \ No newline at end of file +.DS_STORE +.idea/ diff --git a/circle.yml b/circle.yml index af7cd4f..0d3c95e 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,7 @@ -version: 2 +version: 2.1 + jobs: - build: + php-tests: docker: - image: php:7 working_directory: ~/build @@ -29,3 +30,22 @@ jobs: - store_test_results: path: "./tmp/" + + javascript-tests: + docker: + - image: cimg/node:20.19 + working_directory: ~/build + steps: + - checkout + - run: + name: "Run Calendar Parameter Tests" + command: npm run test:calendar + - run: + name: "Run Card Image Widget Tests" + command: npm run test:card-images + +workflows: + tests: + jobs: + - php-tests + - javascript-tests diff --git a/package.json b/package.json index 0a8ed74..c75d112 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "format:js": "wp-scripts format-js", "lint:css": "wp-scripts lint-style", "lint:js": "wp-scripts lint-js", + "test:card-images": "node tests/card-image-widgets.test.js", + "test:calendar": "node tests/calendar-params.test.js", "start": "wp-scripts start showpass-block-src/index.js --output-path=plugin/build-blocks", "packages-update": "wp-scripts packages-update" }, diff --git a/plugin/inc/default-grid.php b/plugin/inc/default-grid.php index 451c12e..5786791 100644 --- a/plugin/inc/default-grid.php +++ b/plugin/inc/default-grid.php @@ -24,6 +24,7 @@ foreach ($events as $key => $event) { // default event link does nothing $event_href = 'javascript:void(0);'; + $image_opens_widget = false; if (isset($event['external_link'])) { $event_href = $event['external_link']; } @@ -35,13 +36,22 @@ */ if (isset($detail_page)) { $event_href = sprintf('/%s/?slug=%s', $detail_page, $event['slug']); + } else { + $image_opens_widget = true; } } ?>
-
\ No newline at end of file + diff --git a/plugin/inc/default-list.php b/plugin/inc/default-list.php index 6d37ad2..1001040 100644 --- a/plugin/inc/default-list.php +++ b/plugin/inc/default-list.php @@ -25,28 +25,37 @@ $event_href = sprintf('/%s/?slug=%s', $detail_page, $event['slug']); } } + $image_opens_widget = !isset($event['external_link']) + && !isset($detail_page) + && !showpass_ticket_sold_out($event); ?>