cartodb-4.42/lib/assets/test/spec/builder/routes/handle-modals-route.spec.js

26 lines
807 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
var handleModalsRoute = require('builder/routes/handle-modals-route');
describe('routes/handleModalsRoute', function () {
it('should handle modals route', function () {
var modals = {
keepOpenOnRouteChange: function () { return false; },
destroy: jasmine.createSpy('destroy')
};
handleModalsRoute(['layer_analyses', 'l1-1', 'a1', null], modals);
expect(modals.destroy).toHaveBeenCalled();
});
it('should not destroy modals when route changes and `keepOpenOnRouteChange` property is enabled', function () {
var modals = {
keepOpenOnRouteChange: function () { return true; },
destroy: jasmine.createSpy('destroy')
};
handleModalsRoute(['layer_analyses', 'l1-1', 'a1', null], modals);
expect(modals.destroy).not.toHaveBeenCalled();
});
});