瀏覽代碼

Add a pagination test case.

NaotoshiFujita 3 年之前
父節點
當前提交
7581094e66

+ 0 - 1
src/js/components/Pagination/Pagination.ts

@@ -182,7 +182,6 @@ export function Pagination( Splide: Splide, Components: Components, options: Opt
   /**
    * Called when any key is pressed on the pagination.
    *
-   * @todo option?
    * @link https://www.w3.org/TR/2021/NOTE-wai-aria-practices-1.2-20211129/#keyboard-interaction-21
    *
    * @param page - A page index.

+ 9 - 0
src/js/components/Pagination/test/tab.test.ts

@@ -111,4 +111,13 @@ describe( 'Pagination', () => {
         .toBe( direction === 'ttb' ? 'vertical' : null );
     } );
   } );
+
+  test( 'should not activate keyboard shortcuts if `paginationKeyboard` option is disabled.', () => {
+    const splide = init( { paginationKeyboard: false, speed: 0 } );
+    const items  = document.getElementsByClassName( CLASS_PAGINATION_PAGE );
+
+    fire( items[ 0 ], 'keydown', { key: 'ArrowRight' } );
+    expect( items[ 1 ] === document.activeElement ).toBe( false );
+    expect( splide.index ).toBe( 0 );
+  } );
 } );

+ 5 - 2
src/js/test/php/examples/default.php

@@ -32,11 +32,14 @@ $settings = get_settings();
 	      waitForTransition: false,
 	      // flickPower: 1,
 	      // flickMaxSlides: 2,
+	      // direction: 'rtl',
 	      dragMinThreshold: {
 					mouse: 20,
 		      touch: 0,
 	      },
-	      speed: 1000,
+	      // focus: 'center',
+	      trimSpace: 'move',
+	      // speed: 3000,
 	      // useScroll: true,
 				// waitForTransition: false,
         // noDrag: 'button',
@@ -98,7 +101,7 @@ $settings = get_settings();
 </head>
 <body>
 
-<?php render( 'splide01', 5 ); ?>
+<?php render( 'splide01', 10 ); ?>
 
 <pre></pre>
 

+ 1 - 0
src/js/test/php/examples/drag-free.php

@@ -22,6 +22,7 @@ $settings = get_settings();
         perPage: 2,
         gap    : '0.5em',
         drag   : 'free',
+	      snap   : true,
         // height : 400,
         type   : 'loop',
         // direction: 'rtl',

+ 2 - 1
src/js/test/php/examples/ttb.php

@@ -20,7 +20,7 @@ $settings = get_settings();
     document.addEventListener( 'DOMContentLoaded', function () {
       var splide = new Splide( '#splide01', {
         width       : 400,
-        // type     : 'loop',
+        type     : 'loop',
         perPage     : 2,
         padding     : '3rem',
         gap         : 5,
@@ -28,6 +28,7 @@ $settings = get_settings();
         height      : '90vh',
         cover       : true,
         // wheel       : true,
+	      waitForTransition: false,
         releaseWheel: true,
 	      wheel       : {
 					// min: 99,