Skip to content

Commit

Permalink
Merge pull request #61 from LowerRockLabs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
lrljoe authored Mar 18, 2023
2 parents 9636ce0 + bb08474 commit 6bbf386
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 28 deletions.
16 changes: 14 additions & 2 deletions resources/views/components/tools/filters/numberRange.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ class="range-slider flat" id="{{ $filterBasePath }}" data-ticks-position='bottom
'>

<input type="range" min="{{ $minRange }}" max="{{ $maxRange }}" value="{{ $currentMax }}"
id="{{ $maxFilterWirePath }}" x-ref='filterMax' x-on:change="updateWire()" />
id="{{ $maxFilterWirePath }}" x-ref='filterMax' x-on:change="updateWire()"
oninput="this.parentNode.style.setProperty('--value-a',this.value); this.parentNode.style.setProperty('--text-value-a', JSON.stringify(this.value))"
/>
<output></output>
<input type="range" min="{{ $minRange }}" max="{{ $maxRange }}" value="{{ $currentMin }}"
id="{{ $minFilterWirePath }}" x-ref='filterMin' x-on:change="updateWire()" />
id="{{ $minFilterWirePath }}" x-ref='filterMin' x-on:change="updateWire()"
oninput="this.parentNode.style.setProperty('--value-b',this.value); this.parentNode.style.setProperty('--text-value-b', JSON.stringify(this.value))"
/>
<output></output>
<div class='range-slider__progress'></div>
</div>
Expand All @@ -195,9 +199,13 @@ class="range-slider flat" id="{{ $filterBasePath }}" data-ticks-position='bottom
'>

<input type="range" min="{{ $minRange }}" max="{{ $maxRange }}" value="{{ $currentMax }}"
oninput="this.parentNode.style.setProperty('--value-a',this.value); this.parentNode.style.setProperty('--text-value-a', JSON.stringify(this.value))"

id="{{ $maxFilterWirePath }}" x-ref='filterMax' x-on:change="updateWire()" />
<output></output>
<input type="range" min="{{ $minRange }}" max="{{ $maxRange }}" value="{{ $currentMin }}"
oninput="this.parentNode.style.setProperty('--value-b',this.value); this.parentNode.style.setProperty('--text-value-b', JSON.stringify(this.value))"

id="{{ $minFilterWirePath }}" x-ref='filterMin' x-on:change="updateWire()" />
<output></output>
<div class='range-slider__progress'></div>
Expand All @@ -218,9 +226,13 @@ class="range-slider flat" id="{{ $filterBasePath }}" data-ticks-position='bottom
'>

<input type="range" min="{{ $minRange }}" max="{{ $maxRange }}" value="{{ $currentMax }}"
oninput="this.parentNode.style.setProperty('--value-a',this.value); this.parentNode.style.setProperty('--text-value-a', JSON.stringify(this.value))"

id="{{ $maxFilterWirePath }}" x-ref='filterMax' x-on:change="updateWire()" />
<output></output>
<input type="range" min="{{ $minRange }}" max="{{ $maxRange }}" value="{{ $currentMin }}"
oninput="this.parentNode.style.setProperty('--value-b',this.value); this.parentNode.style.setProperty('--text-value-b', JSON.stringify(this.value))"

id="{{ $minFilterWirePath }}" x-ref='filterMin' x-on:change="updateWire()" />
<output></output>
<div class='range-slider__progress'></div>
Expand Down
44 changes: 18 additions & 26 deletions tests/Dusk/Web/DatePickerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,25 @@ public static function urlProvider(): array
'TW2' => [
'/tailwind',
],
'TW3' => [
'/tailwind3',
],
'TW2-slidedown' => [
'/tailwind-slidedown',
],
'TW3' => [
'/tailwind3',
],
'TW3-slidedown' => [
'/tailwind3-slidedown',
],


'BS4' => [
'/bootstrap-4',
],/*
],
'BS4-slidedown' => [
'/bootstrap-4-slidedown',
],
/*
'BS5' => [
'/bootstrap-5',
],*/
/*
'BS4-slidedown' => [
'/bootstrap-4-slidedown',
],
],
'BS5-slidedown' => [
'/bootstrap-5-slidedown',
], */
Expand All @@ -53,27 +51,23 @@ public function testDatepickerFilterOpens($baseURL): void

$browser->pause(1000);

$browser->screenshot("datePicker_" . trim($baseURL, '//') . "_1_Initial_Load_" . date('Y-m-d H'));

$browser->press('@filtBtn');

$browser->pause(1000);

$browser->assertDontSee('Wed');
$browser->screenshot("datePicker_" . trim($baseURL, '//') . "_2_Clicked_Filter_Button_" . date('Y-m-d H'));

$browser->pause(1000);
$browser->assertDontSee('Wed');

$browser->click('#users2-filter-verified_before_date');

$browser->pause(1000);

$browser->screenshot(trim($baseURL, '//')."_flatpickrDatepicker-testDatepickerFilterOpens-click-verified_before_date".date('Y-m-d H'));

$browser->assertSee('Sun')->assertSee('Mon')->assertSee('Tue')->assertSee('Wed')->assertSee('Thu')->assertSee('Fri')->assertSee('Sat');

$browser->assertSee('28')->assertSee('15')->assertSee('1')->assertSee('7')->assertSee('25');
$browser->screenshot("datePicker_" . trim($baseURL, '//') . "_3_opened_Flatpickr_" . date('Y-m-d H'));

$browser->assertSee(date('F'));

$browser->screenshot(trim($baseURL, '//')."_flatpickrDatepicker-testDatepickerFilterOpens-click-verified_before_date-seeYear".date('Y-m-d H'));
$browser->assertSee('Sun')->assertSee('Mon')->assertSee('Tue')->assertSee('Wed')->assertSee('Thu')->assertSee('Fri')->assertSee('Sat')->assertSee('28')->assertSee('15')->assertSee('1')->assertSee('7')->assertSee('25')->assertSee(date('F'));

$browser->assertVisible('div.flatpickr-calendar.animate.arrowBottom.arrowLeft.open > div.flatpickr-innerContainer > div > div.flatpickr-days > div > span:nth-child(10)');

Expand All @@ -83,7 +77,7 @@ public function testDatepickerFilterOpens($baseURL): void

$browser->pause(1000);

$browser->screenshot(trim($baseURL, '//')."_flatpickrDatepicker-testDatepickerFilterOpens-AssetSeeDates".date('Y-m-d H'));
$browser->screenshot("datePicker_" . trim($baseURL, '//') . "_4_Selected_Date_" . date('Y-m-d H'));

$browser->press('@filtBtn');

Expand All @@ -93,15 +87,13 @@ public function testDatepickerFilterOpens($baseURL): void

$browser->assertDontSee(date('F j, Y'));

$browser->pause(1000);

$browser->screenshot(trim($baseURL, '//')."_flatpickrDatepicker-testDatepickerFilterOpens-".date('Y-m-d H'));

$browser->assertAttribute('.today', 'aria-label', date('F j, Y'));

$this->assertEquals($browser->attribute('.today', 'aria-label'), date('F j, Y'));

$this->assertNotEquals($browser->attribute('.today', 'aria-label'), Carbon::tomorrow()->format('F j, Y'));

$browser->screenshot("datePicker_" . trim($baseURL, '//') . "_5_Final_Check_" . date('Y-m-d H'));
});
}
/*
Expand Down
95 changes: 95 additions & 0 deletions tests/Dusk/Web/DateRangeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

namespace LowerRockLabs\LaravelLivewireTablesAdvancedFilters\Tests\Dusk\Web;

use Laravel\Dusk\Browser;
use LowerRockLabs\LaravelLivewireTablesAdvancedFilters\Tests\Dusk\DuskTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

final class DateRangeTest extends DuskTestCase
{
public static function urlProvider(): array
{
return [
'TW2' => [
'/tailwind',
],
'TW2-slidedown' => [
'/tailwind-slidedown',
],
'TW3' => [
'/tailwind3',
],
'TW3-slidedown' => [
'/tailwind3-slidedown',
],
'BS4' => [
'/bootstrap-4',
],
'BS4-slidedown' => [
'/bootstrap-4-slidedown',
],

'BS5' => [
'/bootstrap-5',
],
'BS5-slidedown' => [
'/bootstrap-5-slidedown',
],

];
}

/**
* testDatepickerFilterOpens
*/
#[DataProvider('urlProvider')]
public function testDaterangeFilterOpens($baseURL): void
{
$this->browse(function (Browser $browser) use ($baseURL) {
$browser->visit($baseURL);

$browser->pause(1000);

$browser->screenshot("dateRange_" . trim($baseURL, '//') . "_1_Initial_Load_" . date('Y-m-d H'));

$browser->press('@filtBtn');

$browser->pause(1000);

$browser->screenshot("dateRange_" . trim($baseURL, '//') . "_2_Clicked_Filter_Button_" . date('Y-m-d H'));

$browser->assertDontSee('Wed');

$browser->click('#users2-filter-e_mail_verified_range');

$browser->pause(1000);

$browser->screenshot("dateRange_" . trim($baseURL, '//') . "_3_opened_Flatpickr_" . date('Y-m-d H'));

$browser->assertSee('Sun')->assertSee('Mon')->assertSee('Tue')->assertSee('Wed')->assertSee('Thu')->assertSee('Fri')->assertSee('Sat')->assertSee('28')->assertSee('15')->assertSee('1')->assertSee('7')->assertSee('25')->assertSee(date('F'));

$browser->assertVisible('div.flatpickr-calendar.animate.arrowBottom.arrowLeft.open > div.flatpickr-innerContainer > div > div.flatpickr-days > div > span:nth-child(10)');

$firstDate = $browser->attribute('div.flatpickr-calendar.animate.arrowBottom.arrowLeft.open > div.flatpickr-innerContainer > div > div.flatpickr-days > div > span:nth-child(10)', 'aria-label');

$secondDate = $browser->attribute('div.flatpickr-calendar.animate.arrowBottom.arrowLeft.open > div.flatpickr-innerContainer > div > div.flatpickr-days > div > span:nth-child(15)', 'aria-label');

$browser->click('div.flatpickr-calendar.animate.arrowBottom.arrowLeft.open > div.flatpickr-innerContainer > div > div.flatpickr-days > div > span:nth-child(10)');

$browser->click('div.flatpickr-calendar.animate.arrowBottom.arrowLeft.open > div.flatpickr-innerContainer > div > div.flatpickr-days > div > span:nth-child(15)');

$browser->pause(1000);

$browser->screenshot("dateRange_" . trim($baseURL, '//') . "_4_Selected_Dates_" . date('Y-m-d H'));

$browser->press('@filtBtn');

$browser->pause(1000);

$browser->assertSee($firstDate)->assertSee($secondDate);

$browser->screenshot("dateRange_" . trim($baseURL, '//') . "_5_Final_Check_" . date('Y-m-d H'));
});
}
}
97 changes: 97 additions & 0 deletions tests/Dusk/Web/NumberRangeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

namespace LowerRockLabs\LaravelLivewireTablesAdvancedFilters\Tests\Dusk\Web;

use Laravel\Dusk\Browser;
use LowerRockLabs\LaravelLivewireTablesAdvancedFilters\Tests\Dusk\DuskTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

final class NumberRangeTest extends DuskTestCase
{
public static function urlProvider(): array
{
return [
'TW2' => [
'/tailwind',
],
'TW2-slidedown' => [
'/tailwind-slidedown',
],
'TW3' => [
'/tailwind3',
],
'TW3-slidedown' => [
'/tailwind3-slidedown',
],
'BS4' => [
'/bootstrap-4',
],
'BS4-slidedown' => [
'/bootstrap-4-slidedown',
],

'BS5' => [
'/bootstrap-5',
],
'BS5-slidedown' => [
'/bootstrap-5-slidedown',
],

];
}

/**
* testNumberRangeFilterOpens
*/
#[DataProvider('urlProvider')]
public function testNumberRangeFilterOpens($baseURL): void
{
$this->browse(function (Browser $browser) use ($baseURL) {
$browser->visit($baseURL);

$browser->pause(1000);

$browser->screenshot("numberRange_" . trim($baseURL, '//') . "_1_Initial_Load_" . date('Y-m-d H'));

$browser->press('@filtBtn');

$browser->pause(1000);

$browser->screenshot("numberRange_" . trim($baseURL, '//') . "_2_Clicked_Filter_Button_" . date('Y-m-d H'));

$initialMinValue = $browser->value('#users2\.filters\.success_rate\.min');

$this->assertEquals(0, $browser->value('#users2\.filters\.success_rate\.min'));

$initialMaxValue = $browser->value('#users2\.filters\.success_rate\.max');

$this->assertEquals(100, $browser->value('#users2\.filters\.success_rate\.max'));

$browser->pause(1000);

$browser->dragLeft('#users2\.filters\.success_rate\.max', 50);

$browser->value('#users2\.filters\.success_rate\.max', "75");

$this->assertEquals(75, $browser->value('#users2\.filters\.success_rate\.max'));

$browser->pause(500);

$browser->screenshot("numberRange_" . trim($baseURL, '//') . "_4a_First_Drag" . date('Y-m-d H'));

$browser->mouseover('#users2-filter-e_mail_verified_range');

$browser->pause(1000);

$browser->screenshot("numberRange_" . trim($baseURL, '//') . "_4b_Second_Drag" . date('Y-m-d H'));

$this->assertEquals(0, $browser->value('#users2\.filters\.success_rate\.min'));

$browser->mouseover('#users2-filter-e_mail_verified_range');

$browser->pause(2000);

$browser->screenshot("numberRange_" . trim($baseURL, '//') . "_5_Final_Check_" . date('Y-m-d H'));
});
}
}

0 comments on commit 6bbf386

Please sign in to comment.