Merge branch 'develop' into feature/custom-report-scoping

This commit is contained in:
Marcus Moore 2023-08-09 13:03:05 -07:00
commit e0b464dcec
No known key found for this signature in database
16 changed files with 292 additions and 89 deletions

View file

@ -20,10 +20,8 @@ on:
pipeline: pipeline:
- name: Setup - name: Setup
cmd: | cmd: |
cp -v .env.example .env cp -v .env.testing.example .env
# This is simply to allow passing the guard in TestCase@setUp() cp -v .env.testing.example .env.testing
# https://chipperci.com/docs/builds/env
touch .env.testing
composer install --no-interaction --prefer-dist --optimize-autoloader composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Generate Key - name: Generate Key
@ -36,15 +34,15 @@ pipeline:
- name: Run Migrations - name: Run Migrations
cmd: | cmd: |
# php artisan migrate --force php artisan migrate --force
- name: PHPUnit Unit Tests - name: PHPUnit Unit Tests
cmd: | cmd: |
# php artisan test --testsuite Unit php artisan test --testsuite Unit
- name: PHPUnit Feature Tests - name: PHPUnit Feature Tests
cmd: | cmd: |
# php artisan test --testsuite Feature php artisan test --testsuite Feature
# - name: Browser Tests # - name: Browser Tests
# cmd: | # cmd: |

View file

@ -0,0 +1,67 @@
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class CategoryEditForm extends Component
{
public $defaultEulaText;
public $eulaText;
public $originalSendCheckInEmailValue;
public $requireAcceptance;
public $sendCheckInEmail;
public $useDefaultEula;
public function mount()
{
$this->originalSendCheckInEmailValue = $this->sendCheckInEmail;
if ($this->eulaText || $this->useDefaultEula) {
$this->sendCheckInEmail = 1;
}
}
public function render()
{
return view('livewire.category-edit-form');
}
public function updated($property, $value)
{
if (! in_array($property, ['eulaText', 'useDefaultEula'])) {
return;
}
$this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue;
}
public function getShouldDisplayEmailMessageProperty(): bool
{
return $this->eulaText || $this->useDefaultEula;
}
public function getEmailMessageProperty(): string
{
if ($this->useDefaultEula) {
return trans('admin/categories/general.email_will_be_sent_due_to_global_eula');
}
return trans('admin/categories/general.email_will_be_sent_due_to_category_eula');
}
public function getEulaTextDisabledProperty()
{
return (bool)$this->useDefaultEula;
}
public function getSendCheckInEmailDisabledProperty()
{
return $this->eulaText || $this->useDefaultEula;
}
}

View file

@ -215,6 +215,7 @@ class Importer extends Component
'manufacturer' => trans('general.manufacturer'), 'manufacturer' => trans('general.manufacturer'),
'order_number' => trans('general.order_number'), 'order_number' => trans('general.order_number'),
'image' => trans('general.importer.image_filename'), 'image' => trans('general.importer.image_filename'),
'asset_eol_date' => trans('admin/hardware/form.eol_date'),
/** /**
* Checkout fields: * Checkout fields:
* Assets can be checked out to other assets, people, or locations, but we currently * Assets can be checked out to other assets, people, or locations, but we currently

View file

@ -25,6 +25,7 @@ return [
'mailgun' => [ 'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'), 'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'), 'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
], ],
'mandrill' => [ 'mandrill' => [

46
package-lock.json generated
View file

@ -1565,9 +1565,9 @@
} }
}, },
"@types/eslint": { "@types/eslint": {
"version": "8.44.0", "version": "8.44.2",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.0.tgz", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz",
"integrity": "sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==", "integrity": "sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg==",
"requires": { "requires": {
"@types/estree": "*", "@types/estree": "*",
"@types/json-schema": "*" "@types/json-schema": "*"
@ -15962,9 +15962,9 @@
} }
}, },
"jspdf-autotable": { "jspdf-autotable": {
"version": "3.5.25", "version": "3.5.31",
"resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.25.tgz", "resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.31.tgz",
"integrity": "sha512-BIbDd/cilRbVm5PmR+ZonolSqRtm0AvZDpTz+rrWed7BnFj5mqF7x7lkxDAMzPudLapktHUk6cxipcvUzal8cg==" "integrity": "sha512-Lc1KuLGDQWW/5t57Z/+c2E94XQV3jV2QVU3xMRiwvcm/nMx79aCkpPCsxLzJZVFneZvz4XoA8+egQR1QajYiWw=="
}, },
"junk": { "junk": {
"version": "3.1.0", "version": "3.1.0",
@ -19705,9 +19705,9 @@
} }
}, },
"webpack": { "webpack": {
"version": "5.88.1", "version": "5.88.2",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.1.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.2.tgz",
"integrity": "sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ==", "integrity": "sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==",
"requires": { "requires": {
"@types/eslint-scope": "^3.7.3", "@types/eslint-scope": "^3.7.3",
"@types/estree": "^1.0.0", "@types/estree": "^1.0.0",
@ -19736,22 +19736,22 @@
}, },
"dependencies": { "dependencies": {
"@jridgewell/resolve-uri": { "@jridgewell/resolve-uri": {
"version": "3.1.0", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA=="
}, },
"@jridgewell/sourcemap-codec": { "@jridgewell/sourcemap-codec": {
"version": "1.4.14", "version": "1.4.15",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
}, },
"@jridgewell/trace-mapping": { "@jridgewell/trace-mapping": {
"version": "0.3.18", "version": "0.3.19",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
"integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
"requires": { "requires": {
"@jridgewell/resolve-uri": "3.1.0", "@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"@types/json-schema": { "@types/json-schema": {
@ -19788,9 +19788,9 @@
} }
}, },
"terser": { "terser": {
"version": "5.18.2", "version": "5.19.2",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.18.2.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz",
"integrity": "sha512-Ah19JS86ypbJzTzvUCX7KOsEIhDaRONungA4aYBjEP3JZRf4ocuDzTg4QWZnPn9DEMiMYGJPiSOy7aykoCc70w==", "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==",
"requires": { "requires": {
"@jridgewell/source-map": "^0.3.3", "@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2", "acorn": "^8.8.2",

View file

@ -44,7 +44,7 @@
"jquery-ui": "^1.13.2", "jquery-ui": "^1.13.2",
"jquery-ui-bundle": "^1.12.1", "jquery-ui-bundle": "^1.12.1",
"jquery.iframe-transport": "^1.0.0", "jquery.iframe-transport": "^1.0.0",
"jspdf-autotable": "^3.5.24", "jspdf-autotable": "^3.5.30",
"less": "^4.1.2", "less": "^4.1.2",
"less-loader": "^5.0", "less-loader": "^5.0",
"list.js": "^1.5.0", "list.js": "^1.5.0",
@ -54,6 +54,6 @@
"tableexport.jquery.plugin": "1.28.0", "tableexport.jquery.plugin": "1.28.0",
"tether": "^1.4.0", "tether": "^1.4.0",
"vue-resource": "^1.5.2", "vue-resource": "^1.5.2",
"webpack": "^5.87.0" "webpack": "^5.88.2"
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -18,7 +18,7 @@
"/css/dist/skins/skin-green.css": "/css/dist/skins/skin-green.css?id=0a82a6ae6bb4e58fe62d162c4fb50397", "/css/dist/skins/skin-green.css": "/css/dist/skins/skin-green.css?id=0a82a6ae6bb4e58fe62d162c4fb50397",
"/css/dist/skins/skin-contrast.css": "/css/dist/skins/skin-contrast.css?id=da6c7997d9de2f8329142399f0ce50da", "/css/dist/skins/skin-contrast.css": "/css/dist/skins/skin-contrast.css?id=da6c7997d9de2f8329142399f0ce50da",
"/css/dist/skins/skin-red.css": "/css/dist/skins/skin-red.css?id=44bf834f2110504a793dadec132a5898", "/css/dist/skins/skin-red.css": "/css/dist/skins/skin-red.css?id=44bf834f2110504a793dadec132a5898",
"/css/dist/all.css": "/css/dist/all.css?id=ae5d0ce9886bbe4ad4b021c6be19ec36", "/css/dist/all.css": "/css/dist/all.css?id=8b29a53b11e372ceb332b1a2f7026632",
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/css/webfonts/fa-brands-400.ttf": "/css/webfonts/fa-brands-400.ttf?id=e2e2b1797606a266ed55549f5bb5a179", "/css/webfonts/fa-brands-400.ttf": "/css/webfonts/fa-brands-400.ttf?id=e2e2b1797606a266ed55549f5bb5a179",
@ -29,9 +29,9 @@
"/css/webfonts/fa-solid-900.woff2": "/css/webfonts/fa-solid-900.woff2?id=eea38615e7b5dbbaf88c263f2230cc32", "/css/webfonts/fa-solid-900.woff2": "/css/webfonts/fa-solid-900.woff2?id=eea38615e7b5dbbaf88c263f2230cc32",
"/css/webfonts/fa-v4compatibility.ttf": "/css/webfonts/fa-v4compatibility.ttf?id=6ebbf5afc34f54463abc2b81ca637364", "/css/webfonts/fa-v4compatibility.ttf": "/css/webfonts/fa-v4compatibility.ttf?id=6ebbf5afc34f54463abc2b81ca637364",
"/css/webfonts/fa-v4compatibility.woff2": "/css/webfonts/fa-v4compatibility.woff2?id=67b8a78b7e80e805cfa4ee0421895ba4", "/css/webfonts/fa-v4compatibility.woff2": "/css/webfonts/fa-v4compatibility.woff2?id=67b8a78b7e80e805cfa4ee0421895ba4",
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=f5935cf8eaf9c1f71da0c9245d730471", "/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=281bcfe26549412d128f695234961081",
"/js/build/vendor.js": "/js/build/vendor.js?id=3592e07ae9a6d1805a4ea3bd3c034aef", "/js/build/vendor.js": "/js/build/vendor.js?id=3592e07ae9a6d1805a4ea3bd3c034aef",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=40e2dc8b5b29e244bb545f78e2a3242b", "/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=df78f0c4cc93c29c02a41144590f6350",
"/js/dist/all.js": "/js/dist/all.js?id=ba07d399f23b294f7c4983030b757423", "/js/dist/all.js": "/js/dist/all.js?id=ba07d399f23b294f7c4983030b757423",
"/css/dist/skins/skin-green.min.css": "/css/dist/skins/skin-green.min.css?id=0a82a6ae6bb4e58fe62d162c4fb50397", "/css/dist/skins/skin-green.min.css": "/css/dist/skins/skin-green.min.css?id=0a82a6ae6bb4e58fe62d162c4fb50397",
"/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=e36e83c2aa3c3afdbb8ebe2c0309e91d", "/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=e36e83c2aa3c3afdbb8ebe2c0309e91d",

View file

@ -8,6 +8,8 @@ return array(
'clone' => 'Clone Category', 'clone' => 'Clone Category',
'create' => 'Create Category', 'create' => 'Create Category',
'edit' => 'Edit Category', 'edit' => 'Edit Category',
'email_will_be_sent_due_to_global_eula' => 'An email will be sent to the user because the global EULA is being used.',
'email_will_be_sent_due_to_category_eula' => 'An email will be sent to the user because a EULA is set for this category.',
'eula_text' => 'Category EULA', 'eula_text' => 'Category EULA',
'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.', 'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.',
'name' => 'Category Name', 'name' => 'Category Name',

View file

@ -23,59 +23,13 @@
</div> </div>
</div> </div>
<livewire:category-edit-form
:default-eula-text="$snipeSettings->default_eula_text"
<!-- EULA text --> :eula-text="old('eula_text', $item->eula_text)"
<div class="form-group {{ $errors->has('eula_text') ? 'error' : '' }}"> :require-acceptance="old('require_acceptance', $item->require_acceptance)"
<label for="eula_text" class="col-md-3 control-label">{{ trans('admin/categories/general.eula_text') }}</label> :send-check-in-email="old('checkin_email', $item->checkin_email)"
<div class="col-md-7"> :use-default-eula="old('use_default_eula', $item->use_default_eula)"
{{ Form::textarea('eula_text', old('eula_text', $item->eula_text), array('class' => 'form-control', 'aria-label'=>'eula_text')) }} />
<p class="help-block">{!! trans('admin/categories/general.eula_text_help') !!} </p>
<p class="help-block">{!! trans('admin/settings/general.eula_markdown') !!} </p>
{!! $errors->first('eula_text', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<!-- Use default checkbox -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
@if ($snipeSettings->default_eula_text!='')
<label class="form-control">
{{ Form::checkbox('use_default_eula', '1', old('use_default_eula', $item->use_default_eula), ['aria-label'=>'use_default_eula']) }}
<span>{!! trans('admin/categories/general.use_default_eula') !!}</span>
</label>
@else
<label class="form-control form-control--disabled">
{{ Form::checkbox('use_default_eula', '0', old('use_default_eula'), ['class'=>'disabled','disabled' => 'disabled', 'aria-label'=>'use_default_eula']) }}
<span>{!! trans('admin/categories/general.use_default_eula_disabled') !!}</span>
</label>
@endif
</div>
</div>
<!-- Require Acceptance -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::checkbox('require_acceptance', '1', old('require_acceptance', $item->require_acceptance), ['aria-label'=>'require_acceptance']) }}
{{ trans('admin/categories/general.require_acceptance') }}
</label>
</div>
</div>
<!-- Email on Checkin -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::checkbox('checkin_email', '1', old('checkin_email', $item->checkin_email), ['aria-label'=>'checkin_email']) }}
{{ trans('admin/categories/general.checkin_email') }}
</label>
</div>
</div>
@include ('partials.forms.edit.image-upload', ['image_path' => app('categories_upload_path')]) @include ('partials.forms.edit.image-upload', ['image_path' => app('categories_upload_path')])

View file

@ -973,7 +973,12 @@
$(function () { $(function () {
$('[data-tooltip="true"]').tooltip(); // Invoke Bootstrap 3's tooltip
$('[data-tooltip="true"]').tooltip({
container: 'body',
animation: true,
});
$('[data-toggle="popover"]').popover(); $('[data-toggle="popover"]').popover();
$('.select2 span').addClass('needsclick'); $('.select2 span').addClass('needsclick');
$('.select2 span').removeAttr('title'); $('.select2 span').removeAttr('title');

View file

@ -0,0 +1,61 @@
<div>
<!-- EULA text -->
<div class="form-group {{ $errors->has('eula_text') ? 'error' : '' }}">
<label for="eula_text" class="col-md-3 control-label">{{ trans('admin/categories/general.eula_text') }}</label>
<div class="col-md-7">
{{ Form::textarea('eula_text', null, ['wire:model' => 'eulaText', 'class' => 'form-control', 'aria-label'=>'eula_text', 'disabled' => $this->eulaTextDisabled]) }}
<p class="help-block">{!! trans('admin/categories/general.eula_text_help') !!} </p>
<p class="help-block">{!! trans('admin/settings/general.eula_markdown') !!} </p>
{!! $errors->first('eula_text', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
@if ($this->eulaTextDisabled)
<input type="hidden" name="eula_text" wire:model="eulaText" />
@endif
</div>
<!-- Use default checkbox -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
@if ($defaultEulaText!='')
<label class="form-control">
{{ Form::checkbox('use_default_eula', '1', null, ['wire:model' => 'useDefaultEula', 'aria-label'=>'use_default_eula']) }}
<span>{!! trans('admin/categories/general.use_default_eula') !!}</span>
</label>
@else
<label class="form-control form-control--disabled">
{{ Form::checkbox('use_default_eula', '0', null, ['wire:model' => 'useDefaultEula', 'class'=>'disabled','disabled' => 'disabled', 'aria-label'=>'use_default_eula']) }}
<span>{!! trans('admin/categories/general.use_default_eula_disabled') !!}</span>
</label>
@endif
</div>
</div>
<!-- Require Acceptance -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::checkbox('require_acceptance', '1', null, ['wire:model' => 'requireAcceptance', 'aria-label'=>'require_acceptance']) }}
{{ trans('admin/categories/general.require_acceptance') }}
</label>
</div>
</div>
<!-- Email on Checkin -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::checkbox('checkin_email', '1', null, ['wire:model' => 'sendCheckInEmail', 'aria-label'=>'checkin_email', 'disabled' => $this->sendCheckInEmailDisabled]) }}
{{ trans('admin/categories/general.checkin_email') }}
</label>
@if ($this->shouldDisplayEmailMessage)
<div class="callout callout-info">
<i class="far fa-envelope"></i>
<span>{{ $this->emailMessage }}</span>
</div>
@endif
@if ($this->sendCheckInEmailDisabled)
<input type="hidden" name="checkin_email" wire:model="sendCheckInEmail" />
@endif
</div>
</div>
</div>

View file

@ -85,3 +85,12 @@
</div> </div>
@endforeach @endforeach
@endif @endif
<script nonce="{{ csrf_token() }}">
// We have to re-call the tooltip since this is pulled in after the DOM has loaded
$('[data-tooltip="true"]').tooltip({
container: 'body',
animation: true,
});
</script>

View file

@ -0,0 +1,105 @@
<?php
namespace Tests\Feature\Livewire;
use App\Http\Livewire\CategoryEditForm;
use Livewire\Livewire;
use Tests\TestCase;
class CategoryEditFormTest extends TestCase
{
public function testTheComponentCanRender()
{
Livewire::test(CategoryEditForm::class)->assertStatus(200);
}
public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => true,
'eulaText' => '',
'useDefaultEula' => false,
])->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'eulaText' => 'Some Content',
'useDefaultEula' => false,
])->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'eulaText' => '',
'useDefaultEula' => true,
])->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'eulaText' => '',
'useDefaultEula' => false,
])->assertSet('sendCheckInEmail', false);
}
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'useDefaultEula' => false,
])->assertSet('sendCheckInEmail', false)
->set('eulaText', 'Some Content')
->assertSet('sendCheckInEmail', true);
}
public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'useDefaultEula' => false,
])->assertSet('sendCheckInEmail', false)
->set('useDefaultEula', true)
->assertSet('sendCheckInEmail', true)
->assertSet('eulaTextDisabled', true)
->assertSet('sendCheckInEmailDisabled', true);
}
public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula()
{
Livewire::test(CategoryEditForm::class, [
'eulaText' => 'Some Content',
'sendCheckInEmail' => false,
'useDefaultEula' => true,
])
->set('useDefaultEula', false)
->set('eulaText', '')
->assertSet('sendCheckInEmail', false)
->assertSet('sendCheckInEmailDisabled', false);
Livewire::test(CategoryEditForm::class, [
'eulaText' => 'Some Content',
'sendCheckInEmail' => true,
'useDefaultEula' => true,
])
->set('useDefaultEula', false)
->set('eulaText', '')
->assertSet('sendCheckInEmail', true)
->assertSet('sendCheckInEmailDisabled', false);
}
public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'eulaText' => '',
'useDefaultEula' => false,
])->assertSet('eulaTextDisabled', false);
}
}