@@ -7,11 +7,15 @@ const componentPath = 'vendor/lacsso/addon/components/sortable-table.js';
77const testPath = 'tests/unit/components/sortable-table-test.js' ;
88const hostRoutePath = 'app/host/containers/route.js' ;
99const hostRouteTestPath = 'tests/unit/host/containers/route-test.js' ;
10+ const prefsPath = 'app/services/prefs.js' ;
11+ const prefsTestPath = 'tests/unit/services/prefs-test.js' ;
1012const ciPath = 'scripts/ci' ;
1113const component = fs . readFileSync ( componentPath , 'utf8' ) ;
1214const test = fs . readFileSync ( testPath , 'utf8' ) ;
1315const hostRoute = fs . readFileSync ( hostRoutePath , 'utf8' ) ;
1416const hostRouteTest = fs . readFileSync ( hostRouteTestPath , 'utf8' ) ;
17+ const prefs = fs . readFileSync ( prefsPath , 'utf8' ) ;
18+ const prefsTest = fs . readFileSync ( prefsTestPath , 'utf8' ) ;
1519const ci = fs . readFileSync ( ciPath , 'utf8' ) ;
1620const failures = [ ] ;
1721
@@ -31,6 +35,8 @@ for (const marker of [
3135 "paged.set('page', page);" ,
3236 "paged.set('perPage', perPage);" ,
3337 'this._syncPagedContent(out);' ,
38+ 'this.clampPageToContentLength(out.length);' ,
39+ 'clampPageToContentLength(length) {' ,
3440 'Ember.run.throttle(this, this._updateFiltered, 100, false)' ,
3541 'Ember.run.debounce(this, this._updateFiltered, 100, false)' ,
3642] ) {
@@ -39,6 +45,29 @@ for (const marker of [
3945 }
4046}
4147
48+ for ( const marker of [
49+ 'function pageSizePreference(preference, options, fallback)' ,
50+ 'return Ember.computed(preference, {' ,
51+ 'set(key, value) {' ,
52+ 'this.set(preference, normalized);' ,
53+ 'storageTablePerPage: pageSizePreference(' ,
54+ ] ) {
55+ if ( ! prefs . includes ( marker ) ) {
56+ failures . push ( 'PAGE_SIZE_PREFERENCE_CONTRACT_MISSING=' + marker ) ;
57+ }
58+ }
59+
60+ for ( const marker of [
61+ 'page-size computed properties accept legacy two-way binding writes' ,
62+ "service.set('storageTablePerPage', 0)" ,
63+ "assert.equal(service.get('storageTablePerPage'), 0" ,
64+ "records.findBy('name', 'storageTableCount').get('value'), '0'" ,
65+ ] ) {
66+ if ( ! prefsTest . includes ( marker ) ) {
67+ failures . push ( 'PAGE_SIZE_PREFERENCE_TEST_MISSING=' + marker ) ;
68+ }
69+ }
70+
4271for ( const marker of [
4372 "host.followLink('instances')" ,
4473 'Ember.Object.create({' ,
@@ -93,6 +122,7 @@ for (const marker of [
93122 "component.set('page', 2)" ,
94123 'component.setProperties({page: 1, perPage: 2})' ,
95124 'keeps the invocation page size read-only while selecting all rows' ,
125+ 'clamps the current page immediately when live rows are removed' ,
96126 "component.send('changePerPage', '0')" ,
97127 "assert.equal(component.get('perPage'), 1, 'does not write through the caller-owned input')" ,
98128 "assert.equal(prefs.get('storageTableCount'), 0, 'persists the semantic All preference')" ,
0 commit comments