diff --git a/modules/receipt/README.md b/modules/receipt/README.md index 6aad07e..398fb19 100644 --- a/modules/receipt/README.md +++ b/modules/receipt/README.md @@ -1,14 +1,14 @@ -The receipt submodule provides for receipt printing. You may configure custom -receipt header/footer at admin/commerce/config/pos/receipt. +The receipt submodule provides receipt printing. You may configure custom +receipt header/footer at `admin/commerce/config/pos/receipt`. -This module depends on the jQuery print plugin which you should reside -in your /libraries directory at the docroot. +This module depends on the `jQuery.print` plugin which should reside in your +site's `/libraries` directory. -We can install jQuery.print using composer or by downloading manually. +We can install `jQuery.print` using composer or by downloading manually. ### Composer method 1. Open composer.json file of your site. -2. Add `"DoersGuild/jQuery.print": "master"` to the `"require"`. Ex- +2. Add `"DoersGuild/jQuery.print": "master"` to the `"require"`. ``` "require": { . @@ -17,7 +17,7 @@ We can install jQuery.print using composer or by downloading manually. } ``` 3. Add `"libraries/{$name}": ["type:drupal-library"]` -to the `"installer-paths"`. Ex- +to the `"installer-paths"`. ``` "installer-paths": { . @@ -25,26 +25,29 @@ to the `"installer-paths"`. Ex- "libraries/{$name}": ["type:drupal-library"] } ``` -4. Add the below lines of code to `"repositories"` - - +4. Add `DoersGuild/jQuery.print` as a new `package` to `"repositories"`. ``` -{ - "type": "package", - "package": { - "name": "DoersGuild/jQuery.print", - "version": "master", - "type": "drupal-library", - "source": { - "url": "https://github.com/DoersGuild/jQuery.print.git", - "type": "git", - "reference": "origin/master" +"repositories": { + . + . + { + "type": "package", + "package": { + "name": "DoersGuild/jQuery.print", + "version": "master", + "type": "drupal-library", + "source": { + "url": "https://github.com/DoersGuild/jQuery.print.git", + "type": "git", + "reference": "origin/master" + } } - } + } } ``` 5. Run `composer update DoersGuild/jQuery.print`. ### Manual method -1. Create `libraries` folder if it doesn't existin the docroot of website. +1. Create `libraries` folder if it doesn't exists in the docroot of website. 2. `cd` into libraries folder and run `git clone https://github.com/DoersGuild/jQuery.print.git`. diff --git a/modules/receipt/config/install/commerce_pos_receipt.settings.yml b/modules/receipt/config/install/commerce_pos_receipt.settings.yml index c05db45..dffe30e 100644 --- a/modules/receipt/config/install/commerce_pos_receipt.settings.yml +++ b/modules/receipt/config/install/commerce_pos_receipt.settings.yml @@ -1,7 +1,3 @@ -dependencies: - module: - - commerce_pos_receipt - - commerce_pos header: "(logo??)
Company Name/Store#
Address line 1
Address line 2
Phone #" footer: "Thanks for shopping at CompanyName!
Return Policy --
Exchange Policy --
Company Motto
Website --

(optional)
Visit our website for a chance to --" header_format: "html" diff --git a/tests/src/FunctionalJavascript/PosFormTest.php b/tests/src/FunctionalJavascript/PosFormTest.php index 4bf2d1c..3a71712 100644 --- a/tests/src/FunctionalJavascript/PosFormTest.php +++ b/tests/src/FunctionalJavascript/PosFormTest.php @@ -23,6 +23,7 @@ class PosFormTest extends JavascriptTestBase { */ public static $modules = [ 'commerce_pos', + 'commerce_pos_receipt', ]; /** @@ -225,6 +226,7 @@ class PosFormTest extends JavascriptTestBase { // Clicking finish will bring us back to the order item screen - processing // a new order. $this->click('input[name="commerce-pos-finish"]'); + $this->waitForAjaxToFinish(); $web_assert->pageTextContains('Total $0.00'); $web_assert->pageTextNotContains('Cash'); $web_assert->pageTextNotContains('To Pay'); @@ -261,4 +263,12 @@ class PosFormTest extends JavascriptTestBase { $this->assertCount(1, $results); } + /** + * Waits for jQuery to become active and animations to complete. + */ + protected function waitForAjaxToFinish() { + $condition = "(0 === jQuery.active && 0 === jQuery(':animated').length)"; + $this->assertJsCondition($condition, 10000); + } + }