Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Code style: fix code issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Feb 24, 2020
2 parents 1e8bf0a + ecbd5bb commit b148e9c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/dom/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function getAbsoluteRectCoordinates( { left, top } ) {

return {
left: left + scrollX,
top: top + scrollY,
top: top + scrollY
};
}

Expand Down
8 changes: 4 additions & 4 deletions tests/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe( 'Config', () => {
it( 'should set default parameters', () => {
const defaultConfig = {
foo: 1,
bar: 2,
bar: 2
};

config = new Config( {}, defaultConfig );
Expand Down Expand Up @@ -86,11 +86,11 @@ describe( 'Config', () => {
it( 'passed parameters should override default parameters', () => {
const defaultConfig = {
foo: 1,
bar: 2,
bar: 2
};

config = new Config( {
foo: 10,
foo: 10
}, defaultConfig );

expect( config.get( 'foo' ) ).to.equal( 10 );
Expand All @@ -106,7 +106,7 @@ describe( 'Config', () => {
b: {
foo: {
first: 1,
second: 2,
second: 2
}
}
};
Expand Down
48 changes: 24 additions & 24 deletions tests/difftochanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@ import diffToChanges from '../src/difftochanges';

describe( 'diffToChanges', () => {
describe( 'equal patterns', () => {
test( 0, '', '' );
test( 0, 'abc', 'abc' );
testDiff( 0, '', '' );
testDiff( 0, 'abc', 'abc' );
} );

describe( 'insertion', () => {
test( 1, '', 'abc' );
test( 1, 'abc', 'abcd' );
test( 1, 'abc', 'abcdef' );
test( 2, 'abc', 'xxabcyy' );
test( 2, 'abc', 'axxbyyc' );
testDiff( 1, '', 'abc' );
testDiff( 1, 'abc', 'abcd' );
testDiff( 1, 'abc', 'abcdef' );
testDiff( 2, 'abc', 'xxabcyy' );
testDiff( 2, 'abc', 'axxbyyc' );
} );

describe( 'deletion', () => {
test( 1, 'abc', '' );
test( 1, 'abc', 'ac' );
test( 1, 'abc', 'bc' );
test( 1, 'abc', 'ab' );
test( 1, 'abc', 'c' );
test( 2, 'abc', 'b' );
testDiff( 1, 'abc', '' );
testDiff( 1, 'abc', 'ac' );
testDiff( 1, 'abc', 'bc' );
testDiff( 1, 'abc', 'ab' );
testDiff( 1, 'abc', 'c' );
testDiff( 2, 'abc', 'b' );
} );

describe( 'replacement', () => {
test( 2, 'abc', 'def' );
test( 2, 'abc', 'axc' );
test( 2, 'abc', 'axyc' );
test( 2, 'abc', 'xybc' );
test( 2, 'abc', 'abxy' );
testDiff( 2, 'abc', 'def' );
testDiff( 2, 'abc', 'axc' );
testDiff( 2, 'abc', 'axyc' );
testDiff( 2, 'abc', 'xybc' );
testDiff( 2, 'abc', 'abxy' );
} );

describe( 'various', () => {
test( 3, 'abc', 'xbccy' );
test( 2, 'abcdef', 'defabc' );
test( 4, 'abcdef', 'axxdeyyfz' );
test( 4, 'abcdef', 'xybzc' );
test( 5, 'abcdef', 'bdxfy' );
testDiff( 3, 'abc', 'xbccy' );
testDiff( 2, 'abcdef', 'defabc' );
testDiff( 4, 'abcdef', 'axxdeyyfz' );
testDiff( 4, 'abcdef', 'xybzc' );
testDiff( 5, 'abcdef', 'bdxfy' );
} );

it( 'works with arrays', () => {
Expand All @@ -62,7 +62,7 @@ describe( 'diffToChanges', () => {
expect( changes ).to.have.lengthOf( 3 );
} );

function test( expectedChangeNumber, oldStr, newStr ) {
function testDiff( expectedChangeNumber, oldStr, newStr ) {
it( `${ oldStr } => ${ newStr }`, () => {
const changes = diffToChanges( diff( oldStr, newStr ), newStr );
const oldStrChars = Array.from( oldStr );
Expand Down
22 changes: 11 additions & 11 deletions tests/dom/getcommonancestor.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,33 @@ describe( 'getParents', () => {
div = createElement( document, 'div', {}, [ p1, p2 ] );
} );

function test( a, b, lca ) {
function testParents( a, b, lca ) {
expect( getCommonAncestor( a, b ) ).to.equal( lca );
expect( getCommonAncestor( b, a ) ).to.equal( lca );
}

it( 'should return lowest common ancestor of nodes in different tree branches', () => {
test( p1, p2, div );
test( span1, span2, p1 );
test( b, span2, p1 );
test( i, b, div );
testParents( p1, p2, div );
testParents( span1, span2, p1 );
testParents( b, span2, p1 );
testParents( i, b, div );
} );

it( 'should return one of nodes if it is a parent of another node', () => {
test( div, p1, div );
test( p1, b, p1 );
testParents( div, p1, div );
testParents( p1, b, p1 );
} );

it( 'should return the node if both parameters are same', () => {
test( div, div, div );
test( b, b, b );
testParents( div, div, div );
testParents( b, b, b );
} );

it( 'should return null for nodes that do not have common ancestor (different trees)', () => {
const diffB = createElement( document, 'b' );
const diffDiv = createElement( document, 'div', {}, diffB );

test( diffB, span1, null );
test( diffDiv, p1, null );
testParents( diffB, span1, null );
testParents( diffDiv, p1, null );
} );
} );
4 changes: 2 additions & 2 deletions tests/dom/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe( 'getOptimalPosition()', () => {
innerWidth: 10000,
innerHeight: 10000,
scrollX: 100,
scrollY: 100,
scrollY: 100
} );

assertPosition( { element, target, positions: [ attachLeft ] }, {
Expand Down Expand Up @@ -170,7 +170,7 @@ describe( 'getOptimalPosition()', () => {
}, {
position: 'absolute',
borderLeftWidth: '20px',
borderTopWidth: '40px',
borderTopWidth: '40px'
} );

element.parentElement = parent;
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/tickets/148/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function updateSourcePosition() {
target,
positions: [
positions.above,
positions.below,
positions.below
],
limiter
} );
Expand Down

0 comments on commit b148e9c

Please # to comment.