Bladeren bron

Update ballonpanelview tests

panr 5 jaren geleden
bovenliggende
commit
0bb1bba0ea
1 gewijzigde bestanden met toevoegingen van 102 en 2 verwijderingen
  1. 102 2
      packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

+ 102 - 2
packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

@@ -183,9 +183,13 @@ describe( 'BalloonPanelView', () => {
 					BalloonPanelView.defaultPositions.southArrowNorth,
 					BalloonPanelView.defaultPositions.southArrowNorthWest,
 					BalloonPanelView.defaultPositions.southArrowNorthEast,
+					BalloonPanelView.defaultPositions.southArrowNorthMiddleWest,
+					BalloonPanelView.defaultPositions.southArrowNorthMiddleEast,
 					BalloonPanelView.defaultPositions.northArrowSouth,
 					BalloonPanelView.defaultPositions.northArrowSouthWest,
-					BalloonPanelView.defaultPositions.northArrowSouthEast
+					BalloonPanelView.defaultPositions.northArrowSouthEast,
+					BalloonPanelView.defaultPositions.northArrowSouthMiddleWest,
+					BalloonPanelView.defaultPositions.northArrowSouthMiddleEast,
 				],
 				limiter: document.body,
 				fitInViewport: true
@@ -711,7 +715,7 @@ describe( 'BalloonPanelView', () => {
 		} );
 
 		it( 'should have a proper length', () => {
-			expect( Object.keys( positions ) ).to.have.length( 18 );
+			expect( Object.keys( positions ) ).to.have.length( 30 );
 		} );
 
 		// ------- North
@@ -732,6 +736,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "northArrowSouthMiddleEast" position', () => {
+			expect( positions.northArrowSouthMiddleEast( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 50 - arrowVOffset,
+				left: 112.5 + arrowHOffset,
+				name: 'arrow_sme'
+			} );
+		} );
+
 		it( 'should define the "northArrowSouthWest" position', () => {
 			expect( positions.northArrowSouthWest( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 50 - arrowVOffset,
@@ -740,6 +752,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "northArrowSouthMiddleWest" position', () => {
+			expect( positions.northArrowSouthMiddleWest( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 50 - arrowVOffset,
+				left: 162.5 - arrowHOffset,
+				name: 'arrow_smw'
+			} );
+		} );
+
 		// ------- North west
 
 		it( 'should define the "northWestArrowSouth" position', () => {
@@ -758,6 +778,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "northWestArrowSouthMiddleWest" position', () => {
+			expect( positions.northWestArrowSouthMiddleWest( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 50 - arrowVOffset,
+				left: 87.5 - arrowHOffset,
+				name: 'arrow_smw'
+			} );
+		} );
+
 		it( 'should define the "northWestArrowSouthEast" position', () => {
 			expect( positions.northWestArrowSouthEast( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 50 - arrowVOffset,
@@ -766,6 +794,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "northWestArrowSouthMiddleEast" position', () => {
+			expect( positions.northWestArrowSouthMiddleEast( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 50 - arrowVOffset,
+				left: 62.5 + arrowHOffset,
+				name: 'arrow_sme'
+			} );
+		} );
+
 		// ------- North east
 
 		it( 'should define the "northEastArrowSouth" position', () => {
@@ -784,6 +820,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "northEastArrowSouthMiddleEast" position', () => {
+			expect( positions.northEastArrowSouthMiddleEast( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 50 - arrowVOffset,
+				left: 162.5 + arrowHOffset,
+				name: 'arrow_sme'
+			} );
+		} );
+
 		it( 'should define the "northEastArrowSouthWest" position', () => {
 			expect( positions.northEastArrowSouthWest( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 50 - arrowVOffset,
@@ -792,6 +836,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "northEastArrowSouthMiddleWest" position', () => {
+			expect( positions.northEastArrowSouthMiddleWest( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 50 - arrowVOffset,
+				left: 187.5 - arrowHOffset,
+				name: 'arrow_smw'
+			} );
+		} );
+
 		// ------- South
 
 		it( 'should define the "southArrowNorth" position', () => {
@@ -810,6 +862,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "southArrowNorthMiddleEast" position', () => {
+			expect( positions.southArrowNorthMiddleEast( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 200 + arrowVOffset,
+				left: 112.5 + arrowHOffset,
+				name: 'arrow_nme'
+			} );
+		} );
+
 		it( 'should define the "southArrowNorthWest" position', () => {
 			expect( positions.southArrowNorthWest( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 200 + arrowVOffset,
@@ -818,6 +878,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "southArrowNorthMiddleWest" position', () => {
+			expect( positions.southArrowNorthMiddleWest( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 200 + arrowVOffset,
+				left: 137.5 - arrowHOffset,
+				name: 'arrow_nmw'
+			} );
+		} );
+
 		// ------- South west
 
 		it( 'should define the "southWestArrowNorth" position', () => {
@@ -836,6 +904,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "southWestArrowNorthMiddleWest" position', () => {
+			expect( positions.southWestArrowNorthMiddleWest( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 200 + arrowVOffset,
+				left: 87.5 - arrowHOffset,
+				name: 'arrow_nmw'
+			} );
+		} );
+
 		it( 'should define the "southWestArrowNorthEast" position', () => {
 			expect( positions.southWestArrowNorthEast( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 200 + arrowVOffset,
@@ -844,6 +920,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "southWestArrowNorthMiddleEast" position', () => {
+			expect( positions.southWestArrowNorthMiddleEast( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 200 + arrowVOffset,
+				left: 62.5 + arrowHOffset,
+				name: 'arrow_nme'
+			} );
+		} );
+
 		// ------- South east
 
 		it( 'should define the "southEastArrowNorth" position', () => {
@@ -862,6 +946,14 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		it( 'should define the "southEastArrowNorthMiddleEast" position', () => {
+			expect( positions.southEastArrowNorthMiddleEast( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 200 + arrowVOffset,
+				left: 162.5 + arrowHOffset,
+				name: 'arrow_nme'
+			} );
+		} );
+
 		it( 'should define the "southEastArrowNorthWest" position', () => {
 			expect( positions.southEastArrowNorthWest( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 200 + arrowVOffset,
@@ -869,6 +961,14 @@ describe( 'BalloonPanelView', () => {
 				name: 'arrow_nw'
 			} );
 		} );
+
+		it( 'should define the "southEastArrowNorthMiddleWest" position', () => {
+			expect( positions.southEastArrowNorthMiddleWest( targetRect, balloonRect ) ).to.deep.equal( {
+				top: 200 + arrowVOffset,
+				left: 187.5 - arrowHOffset,
+				name: 'arrow_nmw'
+			} );
+		} );
 	} );
 } );