@@ -1086,7 +1086,7 @@ describe('locked segment editor routes', () => {
10861086 ) ;
10871087} ) ;
10881088
1089- describe ( 'deleting a segment says what went with it ' , ( ) => {
1089+ describe ( 'deleting a segment without a success notification ' , ( ) => {
10901090 beforeEach ( async ( ) => {
10911091 setActivePinia ( createPinia ( ) ) ;
10921092 await seatSpecImage ( 'img-1' ) ;
@@ -1115,31 +1115,40 @@ describe('deleting a segment says what went with it', () => {
11151115 await nextTick ( ) ;
11161116 } ;
11171117
1118- it ( 'counts the masks, the images they were on, and the annotations' , async ( ) => {
1118+ const expectDeleted = async ( wrapper : VueWrapper ) => {
1119+ for ( const imageId of [ 'img-1' , 'img-2' ] ) {
1120+ await showImage ( imageId ) ;
1121+ expect ( rowIds ( wrapper ) ) . toEqual ( [ ] ) ;
1122+ expect (
1123+ wrapper
1124+ . get ( '[data-testid="save-segments-button"]' )
1125+ . attributes ( 'disabled' )
1126+ ) . toBeDefined ( ) ;
1127+ }
1128+ expect ( messageTitles ( ) ) . toEqual ( [ ] ) ;
1129+ } ;
1130+
1131+ it ( 'removes a segment and its painted masks across images' , async ( ) => {
11191132 const segmentId = spreadSegment ( [ 'img-1' , 'img-2' ] ) ;
11201133 const wrapper = mountList ( ) ;
11211134 await nextTick ( ) ;
11221135
11231136 await deleteRow ( wrapper , segmentId ) ;
11241137
1125- expect ( messageTitles ( ) ) . toEqual ( [
1126- 'Deleted 2 masks on 2 images and 2 annotations' ,
1127- ] ) ;
1138+ await expectDeleted ( wrapper ) ;
11281139 } ) ;
11291140
1130- it ( 'says one of each in the singular ' , async ( ) => {
1141+ it ( 'removes a segment with content only on another image ' , async ( ) => {
11311142 const segmentId = spreadSegment ( [ 'img-2' ] ) ;
11321143 const wrapper = mountList ( ) ;
11331144 await nextTick ( ) ;
11341145
11351146 await deleteRow ( wrapper , segmentId ) ;
11361147
1137- expect ( messageTitles ( ) ) . toEqual ( [
1138- 'Deleted 1 mask on 1 image and 1 annotation' ,
1139- ] ) ;
1148+ await expectDeleted ( wrapper ) ;
11401149 } ) ;
11411150
1142- it ( 'names only what the segment had ' , async ( ) => {
1151+ it ( 'deletes painted and annotation-only segments ' , async ( ) => {
11431152 const painted = makeMask ( 'img-1' , 'Painted' ) ;
11441153 seedVoxel ( painted . maskId , [ 1 , 1 , 0 ] ) ;
11451154 const shaped = segments ( ) . addSegment ( { name : 'Shaped' } ) ;
@@ -1153,18 +1162,16 @@ describe('deleting a segment says what went with it', () => {
11531162 await nextTick ( ) ;
11541163
11551164 await deleteRow ( wrapper , painted . segmentId ) ;
1165+ expect ( rowIds ( wrapper ) ) . toEqual ( [ shaped ] ) ;
11561166 await deleteRow ( wrapper , shaped ) ;
11571167
1158- expect ( messageTitles ( ) ) . toEqual ( [
1159- 'Deleted 1 mask on 1 image' ,
1160- 'Deleted 1 annotation' ,
1161- ] ) ;
1168+ await expectDeleted ( wrapper ) ;
11621169 } ) ;
11631170
11641171 // A record is minted the moment a segment is resolved as an edit target, so
11651172 // an image can hold one for a segment that was never painted there. Deleting
11661173 // drops the record, but there was nothing on that image to lose.
1167- it ( 'counts no mask on an image the segment was only resolved on ' , async ( ) => {
1174+ it ( 'deletes empty mask records with their segment' , async ( ) => {
11681175 const recorded = makeMask ( 'img-1' , 'Resolved' ) ;
11691176 const allocated = maskOn ( 'img-2' , recorded . segmentId ) ;
11701177 store ( ) . maskVoxels ( allocated . id ) . materialize ( ) ;
@@ -1173,8 +1180,7 @@ describe('deleting a segment says what went with it', () => {
11731180
11741181 await deleteRow ( wrapper , recorded . segmentId ) ;
11751182
1176- expect ( rowIds ( wrapper ) ) . toEqual ( [ ] ) ;
1177- expect ( messageTitles ( ) ) . toEqual ( [ ] ) ;
1183+ await expectDeleted ( wrapper ) ;
11781184 } ) ;
11791185
11801186 it ( 'stays quiet when the segment held nothing' , async ( ) => {
@@ -1184,11 +1190,10 @@ describe('deleting a segment says what went with it', () => {
11841190
11851191 await deleteRow ( wrapper , empty ) ;
11861192
1187- expect ( rowIds ( wrapper ) ) . toEqual ( [ ] ) ;
1188- expect ( messageTitles ( ) ) . toEqual ( [ ] ) ;
1193+ await expectDeleted ( wrapper ) ;
11891194 } ) ;
11901195
1191- it ( 'reports the same cascade when the editor deletes' , async ( ) => {
1196+ it ( 'removes the segment and its painted masks when the editor deletes' , async ( ) => {
11921197 const segmentId = spreadSegment ( [ 'img-1' , 'img-2' ] ) ;
11931198 const wrapper = mountList ( ) ;
11941199 await nextTick ( ) ;
@@ -1199,10 +1204,7 @@ describe('deleting a segment says what went with it', () => {
11991204 editor ( wrapper ) . vm . $emit ( 'delete' ) ;
12001205 await nextTick ( ) ;
12011206
1202- expect ( rowIds ( wrapper ) ) . toEqual ( [ ] ) ;
1203- expect ( messageTitles ( ) ) . toEqual ( [
1204- 'Deleted 2 masks on 2 images and 2 annotations' ,
1205- ] ) ;
1207+ await expectDeleted ( wrapper ) ;
12061208 } ) ;
12071209} ) ;
12081210
0 commit comments