@@ -31,7 +31,7 @@ const setup = (
31
31
describe ( '.fwd1()' , ( ) => {
32
32
test ( 'can use string root as initial point' , ( ) => {
33
33
const { peritext, editor} = setup ( ) ;
34
- const iterator = editor . fwd1 ( peritext . str . id ) ;
34
+ const iterator = editor . fwd ( peritext . pointAbsStart ( ) ) ;
35
35
let str = '' ;
36
36
while ( 1 ) {
37
37
const res = iterator ( ) ;
@@ -44,7 +44,7 @@ describe('.fwd1()', () => {
44
44
test ( 'can iterate through the entire string' , ( ) => {
45
45
const { peritext, editor} = setup ( ) ;
46
46
const start = peritext . pointStart ( ) ! ;
47
- const iterator = editor . fwd1 ( start . id ) ;
47
+ const iterator = editor . fwd ( start ) ;
48
48
let str = '' ;
49
49
while ( 1 ) {
50
50
const res = iterator ( ) ;
@@ -57,7 +57,7 @@ describe('.fwd1()', () => {
57
57
test ( 'can iterate through the entire string, starting from ABS start' , ( ) => {
58
58
const { peritext, editor} = setup ( ) ;
59
59
const start = peritext . pointAbsStart ( ) ! ;
60
- const iterator = editor . fwd1 ( start . id ) ;
60
+ const iterator = editor . fwd ( start ) ;
61
61
let str = '' ;
62
62
while ( 1 ) {
63
63
const res = iterator ( ) ;
@@ -70,7 +70,7 @@ describe('.fwd1()', () => {
70
70
test ( 'can iterate through the entire string, with initial chunk provided' , ( ) => {
71
71
const { peritext, editor} = setup ( ) ;
72
72
const start = peritext . pointStart ( ) ! ;
73
- const iterator = editor . fwd1 ( start . id , start . chunk ( ) ) ;
73
+ const iterator = editor . fwd ( start ) ;
74
74
let str = '' ;
75
75
while ( 1 ) {
76
76
const res = iterator ( ) ;
@@ -83,7 +83,7 @@ describe('.fwd1()', () => {
83
83
test ( 'can iterate starting in the middle of first chunk' , ( ) => {
84
84
const { peritext, editor} = setup ( ) ;
85
85
const start = peritext . pointAt ( 2 ) ;
86
- const iterator = editor . fwd1 ( start . id ) ;
86
+ const iterator = editor . fwd ( start ) ;
87
87
let str = '' ;
88
88
while ( 1 ) {
89
89
const res = iterator ( ) ;
@@ -96,7 +96,7 @@ describe('.fwd1()', () => {
96
96
test ( 'can iterate starting in the middle of first chunk, with initial chunk provided' , ( ) => {
97
97
const { peritext, editor} = setup ( ) ;
98
98
const start = peritext . pointAt ( 2 ) ;
99
- const iterator = editor . fwd1 ( start . id , start . chunk ( ) ) ;
99
+ const iterator = editor . fwd ( start ) ;
100
100
let str = '' ;
101
101
while ( 1 ) {
102
102
const res = iterator ( ) ;
@@ -109,7 +109,7 @@ describe('.fwd1()', () => {
109
109
test ( 'can iterate starting in the middle of second chunk' , ( ) => {
110
110
const { peritext, editor} = setup ( ) ;
111
111
const start = peritext . pointAt ( 6 ) ;
112
- const iterator = editor . fwd1 ( start . id ) ;
112
+ const iterator = editor . fwd ( start ) ;
113
113
let str = '' ;
114
114
while ( 1 ) {
115
115
const res = iterator ( ) ;
@@ -122,7 +122,7 @@ describe('.fwd1()', () => {
122
122
test ( 'can iterate starting in the middle of second chunk, with initial chunk provided' , ( ) => {
123
123
const { peritext, editor} = setup ( ) ;
124
124
const start = peritext . pointAt ( 6 ) ;
125
- const iterator = editor . fwd1 ( start . id , start . chunk ( ) ) ;
125
+ const iterator = editor . fwd ( start ) ;
126
126
let str = '' ;
127
127
while ( 1 ) {
128
128
const res = iterator ( ) ;
@@ -140,7 +140,7 @@ describe('.fwd1()', () => {
140
140
} ) ;
141
141
peritext . overlay . refresh ( ) ;
142
142
const start = peritext . pointAt ( 0 ) ;
143
- const iterator = editor . fwd1 ( start . id , start . chunk ( ) ) ;
143
+ const iterator = editor . fwd ( start ) ;
144
144
let str = '' ;
145
145
const bools : boolean [ ] = [ ] ;
146
146
while ( 1 ) {
@@ -157,7 +157,7 @@ describe('.fwd1()', () => {
157
157
describe ( '.bwd1()' , ( ) => {
158
158
test ( 'can use string root as initial point' , ( ) => {
159
159
const { peritext, editor} = setup ( ) ;
160
- const iterator = editor . bwd1 ( peritext . str . id ) ;
160
+ const iterator = editor . bwd ( peritext . pointAbsEnd ( ) ) ;
161
161
let str = '' ;
162
162
while ( 1 ) {
163
163
const res = iterator ( ) ;
@@ -170,7 +170,7 @@ describe('.bwd1()', () => {
170
170
test ( 'can iterate through the entire string' , ( ) => {
171
171
const { peritext, editor} = setup ( ) ;
172
172
const end = peritext . pointEnd ( ) ! ;
173
- const iterator = editor . bwd1 ( end . id ) ;
173
+ const iterator = editor . bwd ( end ) ;
174
174
let str = '' ;
175
175
while ( 1 ) {
176
176
const res = iterator ( ) ;
@@ -183,7 +183,7 @@ describe('.bwd1()', () => {
183
183
test ( 'can iterate through the entire string, starting from ABS end' , ( ) => {
184
184
const { peritext, editor} = setup ( ) ;
185
185
const end = peritext . pointAbsEnd ( ) ! ;
186
- const iterator = editor . bwd1 ( end . id ) ;
186
+ const iterator = editor . bwd ( end ) ;
187
187
let str = '' ;
188
188
while ( 1 ) {
189
189
const res = iterator ( ) ;
@@ -196,7 +196,7 @@ describe('.bwd1()', () => {
196
196
test ( 'can iterate through the entire string, with initial chunk provided' , ( ) => {
197
197
const { peritext, editor} = setup ( ) ;
198
198
const end = peritext . pointEnd ( ) ! ;
199
- const iterator = editor . bwd1 ( end . id , end . chunk ( ) ) ;
199
+ const iterator = editor . bwd ( end ) ;
200
200
let str = '' ;
201
201
while ( 1 ) {
202
202
const res = iterator ( ) ;
@@ -208,54 +208,54 @@ describe('.bwd1()', () => {
208
208
209
209
test ( 'can iterate starting in the middle of first chunk' , ( ) => {
210
210
const { peritext, editor} = setup ( ) ;
211
- const end = peritext . pointAt ( 2 ) ;
212
- const iterator = editor . bwd1 ( end . id ) ;
211
+ const point = peritext . pointAt ( 2 ) ;
212
+ const iterator = editor . bwd ( point ) ;
213
213
let str = '' ;
214
214
while ( 1 ) {
215
215
const res = iterator ( ) ;
216
216
if ( ! res ) break ;
217
217
str += res . view ( ) ;
218
218
}
219
- expect ( str ) . toBe ( '210 ' ) ;
219
+ expect ( str ) . toBe ( '10 ' ) ;
220
220
} ) ;
221
221
222
222
test ( 'can iterate starting in the middle of first chunk, with initial chunk provided' , ( ) => {
223
223
const { peritext, editor} = setup ( ) ;
224
- const end = peritext . pointAt ( 2 ) ;
225
- const iterator = editor . bwd1 ( end . id , end . chunk ( ) ) ;
224
+ const point = peritext . pointAt ( 2 ) ;
225
+ const iterator = editor . bwd ( point ) ;
226
226
let str = '' ;
227
227
while ( 1 ) {
228
228
const res = iterator ( ) ;
229
229
if ( ! res ) break ;
230
230
str += res . view ( ) ;
231
231
}
232
- expect ( str ) . toBe ( '210 ' ) ;
232
+ expect ( str ) . toBe ( '10 ' ) ;
233
233
} ) ;
234
234
235
235
test ( 'can iterate starting in the middle of second chunk' , ( ) => {
236
236
const { peritext, editor} = setup ( ) ;
237
- const end = peritext . pointAt ( 6 ) ;
238
- const iterator = editor . bwd1 ( end . id ) ;
237
+ const point = peritext . pointAt ( 6 ) ;
238
+ const iterator = editor . bwd ( point ) ;
239
239
let str = '' ;
240
240
while ( 1 ) {
241
241
const res = iterator ( ) ;
242
242
if ( ! res ) break ;
243
243
str += res . view ( ) ;
244
244
}
245
- expect ( str ) . toBe ( '6543210 ' ) ;
245
+ expect ( str ) . toBe ( '543210 ' ) ;
246
246
} ) ;
247
247
248
248
test ( 'can iterate starting in the middle of second chunk, with initial chunk provided' , ( ) => {
249
249
const { peritext, editor} = setup ( ) ;
250
- const end = peritext . pointAt ( 6 ) ;
251
- const iterator = editor . bwd1 ( end . id , end . chunk ( ) ) ;
250
+ const point = peritext . pointAt ( 6 ) ;
251
+ const iterator = editor . bwd ( point ) ;
252
252
let str = '' ;
253
253
while ( 1 ) {
254
254
const res = iterator ( ) ;
255
255
if ( ! res ) break ;
256
256
str += res . view ( ) ;
257
257
}
258
- expect ( str ) . toBe ( '6543210 ' ) ;
258
+ expect ( str ) . toBe ( '543210 ' ) ;
259
259
} ) ;
260
260
261
261
test ( 'returns true for block split chars' , ( ) => {
@@ -266,7 +266,7 @@ describe('.bwd1()', () => {
266
266
} ) ;
267
267
peritext . overlay . refresh ( ) ;
268
268
const start = peritext . pointAt ( 3 ) ;
269
- const iterator = editor . bwd1 ( start . id , start . chunk ( ) ) ;
269
+ const iterator = editor . bwd ( start ) ;
270
270
let str = '' ;
271
271
const bools : boolean [ ] = [ ] ;
272
272
while ( 1 ) {
0 commit comments