Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcd7bd2

Browse files
authored
Merge pull request gridstack#1226 from adumesny/typescript
TS: karma test cases
2 parents f4055ac + e9e984c commit bcd7bd2

File tree

9 files changed

+511
-533
lines changed

9 files changed

+511
-533
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ Also legacy methods that used to take tons of parameters will now take an object
336336
```
337337
removed `addWidget(el, x, y, width, ...)` --> use the widget options version instead `addWidget(el, {x, y, with,...})`
338338
`float()` to get value --> `getFloat()`
339+
'cellHeight()` to get value --> `getCellheight()`
340+
'verticalMargin()` to get value --> `getVerticalMargin()`
339341
```
340342

341343
Changes

doc/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ gridstack.js API
2424
- [addWidget(el, [options])](#addwidgetel-options)
2525
- [batchUpdate()](#batchupdate)
2626
- [compact()](#compact)
27-
- [cellHeight()](#cellheight)
2827
- [cellHeight(val, noUpdate)](#cellheightval-noupdate)
2928
- [cellWidth()](#cellwidth)
3029
- [commit()](#commit)
@@ -35,6 +34,7 @@ gridstack.js API
3534
- [enableMove(doEnable, includeNewWidgets)](#enablemovedoenable-includenewwidgets)
3635
- [enableResize(doEnable, includeNewWidgets)](#enableresizedoenable-includenewwidgets)
3736
- [float(val?)](#floatval)
37+
- [getCellHeight()](#getcellheight)
3838
- [getCellFromPixel(position[, useOffset])](#getcellfrompixelposition-useoffset)
3939
- [isAreaEmpty(x, y, width, height)](#isareaemptyx-y-width-height)
4040
- [locked(el, val)](#lockedel-val)
@@ -52,7 +52,7 @@ gridstack.js API
5252
- [setAnimation(doAnimate)](#setanimationdoanimate)
5353
- [setStatic(staticValue)](#setstaticstaticvalue)
5454
- [update(el, x, y, width, height)](#updateel-x-y-width-height)
55-
- [verticalMargin()](#verticalmargin)
55+
- [getVerticalMargin()](#getverticalmargin)
5656
- [verticalMargin(value, noUpdate)](#verticalmarginvalue-noupdate)
5757
- [willItFit(x, y, width, height, autoPosition)](#willitfitx-y-width-height-autoposition)
5858
- [Utils](#utils)
@@ -261,10 +261,6 @@ starts batch updates. You will see no changes until `commit()` method is called.
261261

262262
re-layout grid items to reclaim any empty space.
263263

264-
### cellHeight()
265-
266-
Gets current cell height.
267-
268264
### cellHeight(val, noUpdate)
269265

270266
Update current cell height. This method rebuilds an internal CSS stylesheet (unless optional noUpdate=true). Note: You can expect performance issues if
@@ -342,6 +338,11 @@ set/get floating widgets (default: `false`)
342338

343339
- `val` - boolean to set true/false, else get the current value
344340

341+
### getCellHeight()
342+
343+
Gets current cell height.
344+
345+
345346
### getCellFromPixel(position[, useOffset])
346347

347348
Get the position of the cell under a pixel on screen.
@@ -478,7 +479,7 @@ Parameters:
478479

479480
Updates widget position/size.
480481

481-
### verticalMargin()
482+
### getVerticalMargin()
482483

483484
returns current vertical margin value.
484485

karma.conf.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,20 @@
33

44
module.exports = function(config) {
55
config.set({
6-
karmaTypescriptConfig: {
7-
compilerOptions: {
8-
module: 'commonjs',
9-
lib: ['dom', 'es6'],
10-
target: 'es5',
11-
sourceMap: true,
12-
declaration: true
13-
}
14-
},
15-
166

177
// base path that will be used to resolve all patterns (eg. files, exclude)
188
basePath: '',
199

2010

2111
// frameworks to use
2212
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
23-
frameworks: ['jasmine', 'karma-typescript'],
13+
frameworks: ['jasmine'],
2414

2515

2616
// list of files / patterns to load in the browser
2717
files: [
2818
'dist/gridstack.all.js',
2919
'spec/*-spec.js',
30-
'src/**/*.ts'
3120
// 'spec/e2e/*-spec.js' issues with ReferenceError: `browser` & `element` is not defined
3221
],
3322

@@ -40,19 +29,17 @@ module.exports = function(config) {
4029
// preprocess matching files before serving them to the browser
4130
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
4231
preprocessors: {
43-
'src/gridstack-dragdrop-plugin.ts': ['coverage'],
44-
'src/gridstack.engine.ts': ['coverage'],
45-
'src/gridstack.ts': ['coverage'],
46-
'src/jqueryui-gridstack-dragdrop-plugin.ts': ['coverage'],
47-
'src/utils.ts': ['coverage'],
48-
'src/*.ts': ['karma-typescript']
32+
'dist/gridstack-engine.js': ['coverage'],
33+
'dist/gridstack.js': ['coverage'],
34+
'dist/jqueryui-gridstack-dragdrop-plugin': ['coverage'],
35+
'dist/utils.js': ['coverage']
4936
},
5037

5138

5239
// test results reporter to use
5340
// possible values: 'dots', 'progress'
5441
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
55-
reporters: ['progress', 'coverage', 'coveralls', 'karma-typescript'],
42+
reporters: ['progress', 'coverage', 'coveralls'],
5643

5744
coverageReporter: {
5845
type: 'lcov', // lcov or lcovonly are required for generating lcov.info files

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"scripts": {
1212
"build": "yarn --no-progress && rm -rf dist/* && webpack && grunt && doctoc ./README.md && doctoc ./doc/README.md && doctoc ./doc/CHANGES.md",
1313
"web": "rm -rf dist/* && webpack",
14-
"test": "karma start karma.conf.js",
15-
"test2": "yarn lint && karma start karma.conf.js",
14+
"test": "yarn lint && karma start karma.conf.js",
1615
"lint": "tsc --noEmit && eslint src/*.ts",
1716
"reset": "rm -rf dist node_modules",
1817
"prepublishOnly": "yarn build"

0 commit comments

Comments
 (0)