Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ravid7000/table-sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
ravid7000 committed Feb 15, 2020
2 parents e1c0bde + 83df8e4 commit af09845
Show file tree
Hide file tree
Showing 8 changed files with 16,206 additions and 6,991 deletions.
18 changes: 18 additions & 0 deletions docs/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
html {
scroll-behavior: smooth;
}

::-webkit-scrollbar {
width: 5px;
}

::-webkit-scrollbar-track {
display: none;
}

::-webkit-scrollbar-thumb {
-webkit-box-shadow: 0 0 3px 0px rgba(0, 0, 0, 0.12);
background-color: rgb(206, 206, 206);
outline: 1px solid slategrey;
}

.container-fluid {
padding-left: 32px;
padding-right: 32px;
Expand Down
22,616 changes: 15,636 additions & 6,980 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A jquery plugin to sort and paginate data in table form",
"main": "dist/table-sortable.js",
"engines": {
"node": "^8.x"
"node": "^12.x"
},
"repository": {
"url": "https://github.com/ravid7000/table-sortable",
Expand Down Expand Up @@ -58,13 +58,11 @@
"fs-extra": "7.0.1",
"html-webpack-plugin": "4.0.0-alpha.2",
"identity-obj-proxy": "3.0.0",
"jest": "^25.0.0",
"jest-pnp-resolver": "1.0.2",
"jest-resolve": "23.6.0",
"jest-watch-typeahead": "^0.2.1",
"jquery": "^3.3.1",
"mini-css-extract-plugin": "0.5.0",
"node-sass": "^4.11.0",
"node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.2.1",
"postcss-flexbugs-fixes": "4.1.0",
Expand All @@ -80,7 +78,7 @@
"resolve": "1.10.0",
"sass-loader": "7.1.0",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.2.2",
"terser-webpack-plugin": "^2.3.4",
"url-loader": "1.1.2",
"webpack": "4.28.3",
"webpack-dev-server": "3.1.14",
Expand All @@ -89,6 +87,8 @@
},
"devDependencies": {
"gh-pages": "^2.2.0",
"jest": "^25.1.0",
"jest-watch-typeahead": "^0.2.1",
"tslint": "^5.13.1",
"typescript": "^3.3.3333",
"webpack-cli": "^3.3.10"
Expand Down Expand Up @@ -134,8 +134,8 @@
"node"
],
"watchPlugins": [
"/node_modules/jest-watch-typeahead/filename.js",
"/node_modules/jest-watch-typeahead/testname.js"
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"babel": {
Expand Down
173 changes: 173 additions & 0 deletions src/TableSortable/__mock__/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
const data = [
{
formCode: 531718,
formName: 'Investment Form',
fullName: 'Test User',
appointmentDate: '13 March, 2017',
appointmentTime: '1:30PM',
phone: '9876543210',
},
{
formCode: 531790,
formName: 'Investment Form 2',
fullName: 'Test User',
appointmentDate: '12 March, 2017',
appointmentTime: '1:35PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
{
formCode: 531334,
formName: 'Investment Form 3',
fullName: 'Test User',
appointmentDate: '10 March, 2017',
appointmentTime: '1:40PM',
phone: '9876543210',
},
{
formCode: 5317,
formName: 'Investment Form 4',
fullName: 'Test User',
appointmentDate: '17 March, 2017',
appointmentTime: '1:20PM',
phone: '9876543210',
},
]

const columns = {
formCode: 'Form Code',
formName: 'Form Name',
fullName: 'Full Name',
appointmentDate: 'Appointment Date',
appointmentTime: 'Appointment Time',
phone: 'Phone',
}

export { data, columns }
97 changes: 97 additions & 0 deletions src/TableSortable/__tests__/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import $ from 'jquery'
import TableSortable from '..'

const rootElm = '#root'

beforeAll(() => {
document.body.innerHTML = `
<div id="root"></div>
`
})
describe('Table Sortable Options:', () => {
test('should be mounted without breaking', () => {
const table = new TableSortable({
element: rootElm,
})
expect(table._isMounted).toStrictEqual(true)
expect($(rootElm).find('table').length).toStrictEqual(1)
})
test('should create options from default options', () => {
const table = new TableSortable({
element: rootElm,
})
expect(table.options).toMatchObject({
element: rootElm,
data: [],
columns: {},
sorting: true,
pagination: true,
paginationContainer: null,
rowsPerPage: 10,
formatCell: null,
formatHeader: null,
searchField: null,
responsive: {},
totalPages: 0,
sortingIcons: {
asc: '<span>▼</span>',
desc: '<span>▲</span>',
},
nextText: '<span>Next</span>',
prevText: '<span>Prev</span>',
onPaginationChange: null,
})
})
test('lifeCycle should call tableWillMount', () => {
const tableWillMount = jest.fn()
const table = new TableSortable({
element: rootElm,
tableWillMount,
})
expect(table.options.tableWillMount).toHaveBeenCalledTimes(1)
})
test('lifeCycle should call tableDidMount', () => {
const tableDidMount = jest.fn()
const table = new TableSortable({
element: rootElm,
tableDidMount,
})
expect(table.options.tableDidMount).toHaveBeenCalledTimes(1)
})
test('lifeCycle should call tableWillUpdate', () => {
const tableWillUpdate = jest.fn()
const table = new TableSortable({
element: rootElm,
tableWillUpdate,
})
table.refresh()
expect(table.options.tableWillUpdate).toHaveBeenCalledTimes(1)
})
test('lifeCycle should call tableDidUpdate', () => {
const tableDidUpdate = jest.fn()
const table = new TableSortable({
element: rootElm,
tableDidUpdate,
})
table.refresh()
expect(table.options.tableDidUpdate).toHaveBeenCalledTimes(1)
})
test('lifeCycle should call tableWillUnmount', () => {
const tableWillUnmount = jest.fn()
const table = new TableSortable({
element: rootElm,
tableWillUnmount,
})
table.distroy()
expect(table.options.tableWillUnmount).toHaveBeenCalledTimes(1)
})
test('lifeCycle should call tableDidUnmount', () => {
const tableDidUnmount = jest.fn()
const table = new TableSortable({
element: rootElm,
tableDidUnmount,
})
table.distroy()
expect(table.options.tableDidUnmount).toHaveBeenCalledTimes(1)
})
})
Loading

0 comments on commit af09845

Please sign in to comment.