-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(filter): default operator of input filter should be empty
- Loading branch information
1 parent
5f2ec3f
commit 17c905d
Showing
16 changed files
with
205 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
<div class="container-fluid"> | ||
<h2>{{title}}</h2> | ||
<div class="subtitle" | ||
[innerHTML]="subTitle"></div> | ||
<div class="subtitle" [innerHTML]="subTitle"></div> | ||
|
||
<button class="btn btn-default btn-sm" | ||
(click)="clearGridStateFromLocalStorage()" | ||
data-test="reset-button"> | ||
<button class="btn btn-default btn-sm" (click)="clearGridStateFromLocalStorage()" data-test="reset-button"> | ||
<i class="fa fa-times"></i> | ||
Clear Grid State from Local Storage & Reset Grid | ||
</button> | ||
<button class="btn btn-default btn-sm" | ||
(click)="switchLanguage()" | ||
data-test="language-button"> | ||
<button class="btn btn-default btn-sm" (click)="switchLanguage()" data-test="language-button"> | ||
<i class="fa fa-language"></i> | ||
Switch Language | ||
</button> | ||
<b>Locale:</b> <span style="font-style: italic" | ||
data-test="selected-locale">{{selectedLanguage + '.json'}}</span> | ||
<b>Locale:</b> | ||
<span style="font-style: italic" data-test="selected-locale"> | ||
{{selectedLanguage + '.json'}} | ||
</span> | ||
|
||
<angular-slickgrid gridId="grid16" | ||
[columnDefinitions]="columnDefinitions" | ||
[gridOptions]="gridOptions" | ||
[dataset]="dataset" | ||
(onAngularGridCreated)="angularGridReady($event)" | ||
(onGridStateChanged)="gridStateChanged($event)" | ||
(onBeforeGridDestroy)="saveCurrentGridState($event)"> | ||
<angular-slickgrid gridId="grid16" [columnDefinitions]="columnDefinitions" [gridOptions]="gridOptions" | ||
[dataset]="dataset" (onAngularGridCreated)="angularGridReady($event)" | ||
(onGridStateChanged)="gridStateChanged($event)" (onBeforeGridDestroy)="saveCurrentGridState($event)"> | ||
</angular-slickgrid> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Example 12: Localization (i18n)', () => { | ||
const fullEnglishTitles = ['Title', 'Description', 'Duration', 'Start', 'Finish', 'Completed', 'Completed']; | ||
const fullFrenchTitles = ['Titre', 'Description', 'Durée', 'Début', 'Fin', 'Terminé', 'Terminé']; | ||
|
||
beforeEach(() => { | ||
cy.restoreLocalStorage(); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.saveLocalStorage(); | ||
}); | ||
|
||
it('should display Example title', () => { | ||
cy.visit(`${Cypress.config('baseExampleUrl')}/localization`); | ||
cy.get('h2').should('contain', 'Example 12: Localization (i18n)'); | ||
}); | ||
|
||
describe('English Locale', () => { | ||
it('should have exact English Column Titles in the grid', () => { | ||
cy.get('#grid12') | ||
.find('.slick-header-columns') | ||
.children() | ||
.each(($child, index) => expect($child.text()).to.eq(fullEnglishTitles[index])); | ||
}); | ||
|
||
it('should filter certain tasks with the word "ask 1" and expect filter to use contain/include text', () => { | ||
const tasks = ['Task 1', 'Task 10', 'Task 11', 'Task 12']; | ||
|
||
cy.get('.grid-canvas') | ||
.find('.slick-row') | ||
.should('be.visible'); | ||
|
||
cy.get('input.filter-title') | ||
.type('ask 1'); | ||
|
||
cy.get('#grid12') | ||
.find('.slick-row') | ||
.each(($row, index) => { | ||
if (index > tasks.length - 1) { | ||
return; | ||
} | ||
cy.wrap($row).children('.slick-cell') | ||
.first() | ||
.should('contain', tasks[index]); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('French locale', () => { | ||
it('should reset filters and switch locale to French', () => { | ||
cy.get('#grid12') | ||
.find('button.slick-gridmenu-button') | ||
.trigger('click') | ||
.click(); | ||
|
||
cy.get(`.slick-gridmenu:visible`) | ||
.find('.slick-gridmenu-item') | ||
.first() | ||
.find('span') | ||
.contains('Clear All Filters') | ||
.click(); | ||
|
||
cy.get('[data-test=language-button]') | ||
.click(); | ||
|
||
cy.get('[data-test=selected-locale]') | ||
.should('contain', 'fr.json'); | ||
}); | ||
|
||
it('should have French Column Titles in the grid after switching locale', () => { | ||
cy.get('#grid12') | ||
.find('.slick-header-columns') | ||
.children() | ||
.each(($child, index) => expect($child.text()).to.eq(fullFrenchTitles[index])); | ||
}); | ||
|
||
it('should filter certain tasks', () => { | ||
const tasks = ['Tâche 1', 'Tâche 10', 'Tâche 11', 'Tâche 12']; | ||
|
||
cy.get('.grid-canvas') | ||
.find('.slick-row') | ||
.should('be.visible'); | ||
|
||
cy.get('input.filter-title') | ||
.type('âche 1'); | ||
|
||
cy.get('#grid12') | ||
.find('.slick-row') | ||
.each(($row, index) => { | ||
if (index > tasks.length - 1) { | ||
return; | ||
} | ||
cy.wrap($row).children('.slick-cell') | ||
.first() | ||
.should('contain', tasks[index]); | ||
}); | ||
}); | ||
|
||
it('should reset filters before filtering duration', () => { | ||
cy.get('#grid12') | ||
.find('button.slick-gridmenu-button') | ||
.trigger('click') | ||
.click(); | ||
|
||
cy.get(`.slick-gridmenu:visible`) | ||
.find('.slick-gridmenu-item') | ||
.first() | ||
.find('span') | ||
.contains('Supprimer tous les filtres') | ||
.click(); | ||
}); | ||
|
||
it('should filter duration with slider filter', () => { | ||
cy.get('.filter-duration input[type=range]').as('range') | ||
.invoke('val', 25) | ||
.trigger('change'); | ||
|
||
cy.get('#grid12') | ||
.find('.slick-row') | ||
.each(($row, index) => { | ||
let fullCellWidth; | ||
|
||
// only checks first 5 rows | ||
if (index > 5) { | ||
return; | ||
} | ||
|
||
// get full cell width of the first cell, then return | ||
cy.wrap($row).children('.slick-cell:nth(2)') | ||
.first() | ||
.then(($cell) => fullCellWidth = $cell.width()); | ||
|
||
|
||
cy.wrap($row) | ||
.children('.slick-cell:nth(2)') | ||
.children() | ||
.should('have.css', 'background-color', 'rgb(255, 0, 0)') | ||
.should(($el) => { | ||
// calculate 25% and expect the element width to be about the calculated size with a (+/-)1px precision | ||
const expectedWidth = (fullCellWidth * .25); | ||
expect($el.width()).greaterThan(expectedWidth - 1); | ||
expect($el.width()).lessThan(expectedWidth + 1); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.