Files
zulip/frontend_tests/node_tests/lib/compose_banner.js
evykassirer 1b0a14bf40 compose banner: Add specific functions to clear warnings and errors.
Instead of removing all compose banners, we now remove only warnings
and errors -- this makes no difference right now, but this change
will allow us to add other compose banners that are cleared at
different times.
2022-12-14 20:36:07 -08:00

15 lines
582 B
JavaScript

"use strict";
const compose_banner = require("../../../static/js/compose_banner");
const $ = require("../../zjsunit/zjquery");
exports.mock_banners = () => {
// zjquery doesn't support `remove`, which is used when clearing the compose box.
// TODO: improve how we test this so that we don't have to mock things like this.
for (const classname of Object.values(compose_banner.CLASSNAMES)) {
$(`#compose_banners .${classname}`).remove = () => {};
}
$("#compose_banners .warning").remove = () => {};
$("#compose_banners .error").remove = () => {};
};