@@ -172,7 +172,7 @@ describe("CacheGroupTableComponent", () => {
172172 return fail ( `invalid 'Open in New Tab' context menu item; either not a link or has a static href: ${ menuItem } ` ) ;
173173 }
174174 expect ( menuItem . newTab ) . toBeTrue ( ) ;
175- expect ( menuItem . href ( { ...sampleCG , id : 5 } ) ) . toBe ( "core/cache-groups/ 5" ) ;
175+ expect ( menuItem . href ( { ...sampleCG , id : 5 } ) ) . toBe ( "5" ) ;
176176
177177 menuItem = component . contextMenuItems . find ( i => i . name === "Edit" ) ;
178178 if ( ! menuItem ) {
@@ -182,13 +182,13 @@ describe("CacheGroupTableComponent", () => {
182182 return fail ( `invalid 'Edit' context menu item; either not a link or has a static href: ${ menuItem } ` ) ;
183183 }
184184 expect ( menuItem . newTab ) . toBeFalsy ( ) ;
185- expect ( menuItem . href ( { ...sampleCG , id : 5 } ) ) . toBe ( "core/cache-groups/ 5" ) ;
185+ expect ( menuItem . href ( { ...sampleCG , id : 5 } ) ) . toBe ( "5" ) ;
186186 } ) ;
187187
188- it ( "generates 'Manage ASNs' context menu item href" , ( ) => {
189- const item = component . contextMenuItems . find ( i => i . name === "Manage ASNs" ) ;
188+ it ( "generates 'View ASNs' context menu item href" , ( ) => {
189+ const item = component . contextMenuItems . find ( i => i . name === "View ASNs" ) ;
190190 if ( ! item ) {
191- return fail ( "missing 'Manage ASNs' context menu item" ) ;
191+ return fail ( "missing 'View ASNs' context menu item" ) ;
192192 }
193193 if ( isAction ( item ) ) {
194194 return fail ( "expected an action, not a link" ) ;
@@ -197,7 +197,7 @@ describe("CacheGroupTableComponent", () => {
197197 return fail ( "missing 'href' property" ) ;
198198 }
199199 if ( typeof ( item . href ) !== "string" ) {
200- return fail ( "'Manage ASNs' context menu item should use a static string to determine href, instead uses a function" ) ;
200+ return fail ( "'View ASNs' context menu item should use a static string to determine href, instead uses a function" ) ;
201201 }
202202 expect ( item . href ) . toBe ( "/core/asns" ) ;
203203 if ( typeof ( item . queryParams ) !== "function" ) {
@@ -210,38 +210,23 @@ describe("CacheGroupTableComponent", () => {
210210 expect ( item . newTab ) . toBeFalsy ( ) ;
211211 } ) ;
212212
213- it ( "doesn't allow selection of unimplemented context menu items " , ( ) => {
214- let menuItem = component . contextMenuItems . find ( i => i . name === "Manage Servers" ) ;
213+ it ( "builds links to the servers in a Cache Group " , ( ) => {
214+ const menuItem = component . contextMenuItems . find ( i => i . name === "View Servers" ) ;
215215 if ( ! menuItem ) {
216- return fail ( "'Manage Servers' context menu item not found" ) ;
216+ return fail ( "'View Servers' context menu item not found" ) ;
217217 }
218- if ( ! isAction ( menuItem ) ) {
219- return fail ( `Invalid 'Manage Servers' context menu item; not an action: ${ menuItem } ` ) ;
220- }
221- if ( typeof ( menuItem . disabled ) !== "function" ) {
222- return fail ( "'Manage Servers' context menu item should be disabled, but no disabled function is defined" ) ;
223- }
224- if ( menuItem . multiRow ) {
225- expect ( menuItem . disabled ( [ sampleCG ] ) ) . toBeTrue ( ) ;
226- } else {
227- expect ( menuItem . disabled ( sampleCG ) ) . toBeTrue ( ) ;
218+ if ( isAction ( menuItem ) ) {
219+ return fail ( "Invalid 'View Servers' context menu item; not a link" ) ;
228220 }
229221
230- menuItem = component . contextMenuItems . find ( i => i . name === "Manage Parameters" ) ;
231- if ( ! menuItem ) {
232- return fail ( "'Manage Parameters' context menu item not found" ) ;
233- }
234- if ( ! isAction ( menuItem ) ) {
235- return fail ( `Invalid 'Manage Parameters' context menu item; not an action: ${ menuItem } ` ) ;
236- }
237- if ( typeof ( menuItem . disabled ) !== "function" ) {
238- return fail ( "'Manage Parameters' context menu item should be disabled, but no disabled function is defined" ) ;
239- }
240- if ( menuItem . multiRow ) {
241- expect ( menuItem . disabled ( [ sampleCG ] ) ) . toBeTrue ( ) ;
242- } else {
243- expect ( menuItem . disabled ( sampleCG ) ) . toBeTrue ( ) ;
222+ expect ( menuItem . href ) . toBe ( "/core/servers" ) ;
223+ expect ( menuItem . newTab ) . toBeFalsy ( ) ;
224+ expect ( menuItem . fragment ) . not . toBeDefined ( ) ;
225+ expect ( menuItem . queryParams ) . toBeDefined ( ) ;
226+ if ( typeof ( menuItem . queryParams ) !== "function" ) {
227+ return fail ( "invalid 'View Servers' context menu item; query params not a function" ) ;
244228 }
229+ expect ( menuItem . queryParams ( sampleCG ) ) . toEqual ( { cachegroup : sampleCG . name } ) ;
245230 } ) ;
246231
247232 it ( "initializes from query string parameters" , fakeAsync ( ( ) => {
0 commit comments