Skip to content

Commit

Permalink
AG-13294 - add framework tests, make rule more specific to cellRender…
Browse files Browse the repository at this point in the history
…erParams
  • Loading branch information
Stephanemw committed Nov 15, 2024
1 parent 7d8fd00 commit 1f512ee
Show file tree
Hide file tree
Showing 27 changed files with 498 additions and 59 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div>
<ag-grid-angular
[columnDefs]="[[{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}]]"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
<ag-grid-angular
[columnDefs]="columnDefs"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @ts-nocheck
import { ColDef, ColGroupDef, GridReadyEvent } from '@ag-grid-community/core';
import { AgGridAngular } from '@ag-grid-community/angular';
import { HttpClient } from '@angular/common/http';
import { Component, ViewChild } from '@angular/core';
import { IOlympicData } from './interfaces';

@Component({
selector: 'my-app',
templateUrl: './component.html',
})
export class AppComponent {
@ViewChild(AgGridAngular) private grid!: AgGridAngular;
public columnDefs: (ColDef | ColGroupDef)[] = [{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}];
public rowData!: IOlympicData[];

constructor(private http: HttpClient) {
}

onGridReady(params: GridReadyEvent<IOlympicData>) {
this.http
.get<IOlympicData[]>('https://www.ag-grid.com/example-assets/olympic-winners.json')
.subscribe((data) => {
this.rowData = data;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div>
<ag-grid-angular
[columnDefs]="[[{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}]]"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
<ag-grid-angular
[columnDefs]="columnDefs"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-nocheck
import { ColDef, ColGroupDef, GridReadyEvent } from '@ag-grid-community/core';
import { AgGridAngular } from '@ag-grid-community/angular';
import { HttpClient } from '@angular/common/http';
import { Component, ViewChild } from '@angular/core';
import { IOlympicData } from './interfaces';

@Component({
selector: 'my-app',
templateUrl: './component.html',
})
export class AppComponent {
@ViewChild(AgGridAngular) private grid!: AgGridAngular;
public columnDefs: (ColDef | ColGroupDef)[] = [{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {
type: "bar",
direction: "vertical"
}}}];
public rowData!: IOlympicData[];

constructor(private http: HttpClient) {
}

onGridReady(params: GridReadyEvent<IOlympicData>) {
this.http
.get<IOlympicData[]>('https://www.ag-grid.com/example-assets/olympic-winners.json')
.subscribe((data) => {
this.rowData = data;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"scenario": {
"input": "input.component.ts",
"output": "output.component.ts",
"errors": "output.errors.cjs",
"warnings": "output.warnings.cjs"
},
"files": {
"input": {
"component.html": "input.component.html"
},
"expected": {
"component.html": "output.component.html"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// @ts-nocheck
import { AdvancedFilterModel, ColDef, ColGroupDef, GridReadyEvent } from '@ag-grid-community/core';
import { AgGridAngular } from '@ag-grid-community/angular';
import { HttpClient } from '@angular/common/http';
import { Component, ViewChild } from '@angular/core';
import { IOlympicData } from './interfaces';

@Component({
selector: 'my-app',
template: `<div>
<ag-grid-angular
[columnDefs]="columnDefs"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
<ag-grid-angular
[columnDefs]="[{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}]"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
</div>`,
})
export class AppComponent {
@ViewChild(AgGridAngular) private grid!: AgGridAngular;
public columnDefs: (ColDef | ColGroupDef)[] = [{
field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}
}];
public rowData!: IOlympicData[];

constructor(private http: HttpClient) {
}

onGridReady(params: GridReadyEvent<IOlympicData>) {
this.http
.get<IOlympicData[]>('https://www.ag-grid.com/example-assets/olympic-winners.json')
.subscribe((data) => {
this.rowData = data;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @ts-nocheck
import { AdvancedFilterModel, ColDef, ColGroupDef, GridReadyEvent } from '@ag-grid-community/core';
import { AgGridAngular } from '@ag-grid-community/angular';
import { HttpClient } from '@angular/common/http';
import { Component, ViewChild } from '@angular/core';
import { IOlympicData } from './interfaces';

@Component({
selector: 'my-app',
template: `<div>
<ag-grid-angular
[columnDefs]="columnDefs"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
<ag-grid-angular
[columnDefs]="[{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}]"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
</div>`,
})
export class AppComponent {
@ViewChild(AgGridAngular) private grid!: AgGridAngular;
public columnDefs: (ColDef | ColGroupDef)[] = [{
field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {
type: "bar",
direction: "vertical"
}}
}];
public rowData!: IOlympicData[];

constructor(private http: HttpClient) {
}

onGridReady(params: GridReadyEvent<IOlympicData>) {
this.http
.get<IOlympicData[]>('https://www.ag-grid.com/example-assets/olympic-winners.json')
.subscribe((data) => {
this.rowData = data;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"scenario": {
"input": "input.component.ts",
"output": "output.component.ts",
"errors": "output.errors.cjs",
"warnings": "output.warnings.cjs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { AgGridReact } from '@ag-grid-community/react';

function MyComponent(props) {

const shouldntChange0 = {
sparklineOptions: {
type: 'column'
}
}

const anotherColumn = {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: 'column'
}
}
}

return (
<div>
<AgGridReact columnDefs={[{
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: 'line'
}
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: 'area'
}
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
sparklineOptions: {
type: 'bar'
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: 'column'
}
}
}, anotherColumn, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
sparklineOptions: {
type: 'column'
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
sparklineOptions: {
type: 'asdadasqda'
}
}]} rowData={[]}/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { AgGridReact } from '@ag-grid-community/react';

function MyComponent(props) {

const shouldntChange0 = {
sparklineOptions: {
type: 'column'
}
}

const anotherColumn = {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: "bar",
direction: "vertical"
}
}
}

return (
(<div>
<AgGridReact columnDefs={[{
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: 'line'
}
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: 'area'
}
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
sparklineOptions: {
type: 'bar'
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
cellRendererParams: {
sparklineOptions: {
type: "bar",
direction: "vertical"
}
}
}, anotherColumn, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
sparklineOptions: {
type: 'column'
}
}, {
field: 'test',
cellRenderer: 'agSparklineCellRenderer',
sparklineOptions: {
type: 'asdadasqda'
}
}]} rowData={[]}/>
</div>)
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"scenario": {
"input": "input.jsx",
"output": "output.jsx",
"errors": "output.errors.cjs",
"warnings": "output.warnings.cjs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<div>
<ag-grid-vue
:columnDefs="[[{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}]"
:rowData="rowData"
@grid-ready="onGridReady"
></ag-grid-vue>
<ag-grid-vue
:columnDefs="columnDefs"
:rowData="rowData"
@grid-ready="onGridReady"
></ag-grid-vue>
</div>
</template>

<script>
import { AgGridVue } from '@ag-grid-community/vue';
export default {
components: {
'ag-grid-vue': AgGridVue,
},
data() {
return {
columnDefs: [{field: 'test', cellRenderer: 'agSparklineRenderer', cellRendererParams: {sparklineOptions: {type: 'column'}}}],
rowData: [],
};
},
methods: {
onGridReady(params) {
},
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Loading

0 comments on commit 1f512ee

Please sign in to comment.