Commit Graph

82 Commits

Author SHA1 Message Date
Cynthia Lin 0b800b0a7d icons: Create framework for custom icons and add new bot icon. 2017-11-10 11:18:42 -08:00
derAnfaenger 19bc55aa45 Fix various typos.
The typos and their corrections were found with the
aid of https://github.com/lucasdemarchi/codespell.
2017-11-09 16:26:38 +01:00
Steve Howell cdc1bf3d5e node test: Remove add_dependencies(). 2017-11-08 12:24:17 -08:00
Steve Howell ba79558257 node tests: Use zrequire in markdown.js. 2017-11-08 12:24:17 -08:00
Tim Abbott 82b708b721 eslint: Add and enforce space-in-parens lint rule. 2017-10-06 12:36:59 -07:00
Brock Whittaker dba09c979c Restructure organization settings and permissions.
This restructures organization settings and permissions to be
more accurately grouped and for the permissions page to not be too
long.

CHANGES:

PROFILE:
    (this was split out)
    organization-profile-admin.handlebars:
        form #1:
            name
            description
            (SUBMIT)
        avatar:
            (UPLOAD)
            (DELETE)

SETTINGS:
    organization-settings-admin.handlebars:
        language (mostly untouched)
        message editing:
            time limit/history/retention
        message feed:
            mandatory-topics
            preview images
            preview websites

PERMISSIONS:
    organization-permissions-admin.handlebars
    (mostly stuff was removed)
    Joining:
        restrict domains
        require invite
    User Identity:
        name changes
        email changes
    Streams/Emoji:
        creating streams:
            waiting period (ADDED)
        adding emojis
    (SUBMIT) for whole panel

The profile group (name, description, avatar) were split into a new
page that did not previously exist, and the permissions was stripped
of message settings (message editing, message feed), but keeping the
"waiting period" input and putting it in the "Streams & custom emoji"
section.

Fixes: #5844.
2017-08-28 17:20:13 -07:00
Steve Howell 2f775c3e0b node tests: Extract zrequire helper.
We are phasing out the following in tests:

    add_dependencies - this is just kind of a clunky UI
    require - normal JS requires cause test leaks

In order to plug require leaks, we are effectively doing what
we always have done inside of add_dependencies, which is to
keep track of which modules we have done `require` on, and
these get cleared between tests.

Now we just use `zrequire` every time we want to pull in real
code to our global namespace.
2017-08-09 12:32:09 -07:00
Pweaver (Paul Weaver) d3ffc81726 Enable Hot Module Replacement in webpack.
This allow the webbpack dev server to properly reload JavaScript modules
while running in dev without restarting the server. We need to connect
to webpack-dev-server directly because SockJS doesn't support more than
one connection on the same host/port.
2017-07-18 11:02:05 -07:00
Steve Howell 359c9aaec8 zjquery: Remove jquery_array().
This commit simplifies how our zjquery objects are constructed.

We used to have a strange array proxy (my fault) that turns out
to be unnecessary.
2017-07-09 08:31:22 -04:00
Steve Howell 7376934a77 zjquery: Add $.create() method.
This commit add $.create(), which allows you to create a
jQuery object that just has a name to identify it, as opposed
to some selector or HTML fragment.  It's useful for things that
are really used as stubs.

This also fixes a bunch of the existing tests to use $.create().

Before this fix, you could actually just do $('some-stub'), but
now we enforce that the input to $() looks like a valid selector
or HTML fragment, and we make some exceptions for things like
window-stub and document-stub.
2017-07-08 10:32:32 -04:00
Steve Howell 90777fd1fa zjquery: Add parents() and set_parents_result(). 2017-07-08 08:49:09 -04:00
Steve Howell ccd821e29b zjquery: Rename add_child() to set_find_results().
Hopefully this will make it more explicit that zjquery does
not truly simulate DOM, but it instead allows you to dynamically
set what you want the results of $('foo').find(some_selector)
to be.
2017-07-08 08:31:18 -04:00
Steve Howell 70407e080d zjquery: Require explicit set_parent() calls.
Before this commit, we were erroneously setting up parents
as part of add_child() calls, but it's not necessarily the
case that those children are immediate children, and therefore
the first object is not necessarily the immediate parent.
2017-07-08 08:21:27 -04:00
Steve Howell c91eca291c zjquery: Remove broken code related to remove().
The logic to remove ourself from the parent's children wasn't
correct.
2017-07-08 07:57:02 -04:00
Steve Howell b3848ed8bd zjquery: Assert only one function gets triggered.
If multiple functions get called by trigger(), it is almost
certainly a sign of overly complex test setup.
2017-07-06 10:27:54 -04:00
Aditya Bansal 9c90a3d1a3 zjquery: Add get_on_handler(). 2017-07-06 08:37:39 -04:00
Aditya Bansal 641b38f79b zjquery: Add get_on_handlers(). 2017-07-06 08:36:38 -04:00
Aditya Bansal 3b30701844 zjquery: Add selector param option to on() function. 2017-07-06 08:29:07 -04:00
Aditya Bansal a103949c2b i18n.js: Fix issue of i18n stub not returning 'translated: ' prefix. 2017-06-29 15:18:08 -04:00
Aditya Bansal 4d84be16ca i18n.js: Fix issue with i18n being cleaned up in namespace cleanup. 2017-06-29 15:18:08 -04:00
Aditya Bansal 103f19e236 zjsunit: Add i18n minimal lib. 2017-06-28 07:34:04 -04:00
Aditya Bansal 1ed499fffc zjquery: Add stop() function. 2017-06-28 07:34:04 -04:00
Aditya Bansal bd370993ea zjquery: Add fadeTo() function. 2017-06-28 07:34:04 -04:00
Aditya Bansal fb723f9477 zjquery: Reorder functions in lexographic order. 2017-06-28 07:34:04 -04:00
Yago González 8ae0c90e9f zjquery: Return element in some jQuery methods.
jQuery's behavior in methods that, because of their nature, don't need to
return anything is to return the element itself in the jQuery object form.

Now the zjquery element is returned when one of these methods is called.
2017-06-26 08:38:21 -04:00
Yago González 1343216002 zjquery: Add select function. 2017-06-26 08:38:21 -04:00
Yago González 4b8a52cee0 zjquery: Handle passing elements to $().
There are some cases when the jQuery dollar
function is called with an element as argument.

If such element has already been created using
zjquery, we should simply return it.
2017-06-26 08:38:21 -04:00
Yago González 679325733d zjquery: Add extend method. 2017-06-26 08:38:21 -04:00
Yago González a9c8efe871 zjquery: Add keydown and keyup functions. 2017-06-26 08:38:21 -04:00
Yago González ad154da174 zjquery: Add generic event setter/handler. 2017-06-26 08:38:21 -04:00
Joshua Pan 8a6e8906bd zjquery: Add .click() function. 2017-06-20 19:49:23 -04:00
Steve Howell 6c722843ef node tests: Fix namespace leaks related to require().
The node tests have purged modules from cache that were
included via things like set_global(), but calling require
directly would leak modules into the next test, which made
a couple tests only work when you ran the whole suite.  I
fixed those tests to work standalone.  And then I now make
dependencies explicitly clear the require cache before we
require them in namespace.js.
2017-06-19 22:36:58 -04:00
Steve Howell e0d79acac0 zjquery: Add attr() method. 2017-06-16 14:58:27 -04:00
Steve Howell f91dc2fec9 zjquery: Add prop() function. 2017-06-16 08:47:54 -04:00
Steve Howell dc9ea24d79 zjquery: Add get(). 2017-06-14 15:29:17 -04:00
Steve Howell 7722539504 zjquery: Add better trigger stubbing. 2017-06-14 15:26:41 -04:00
Steve Howell 5272b6644e zjquery: Support $('<div>').html(). 2017-06-14 08:17:03 -04:00
Steve Howell 736f4c2930 zjquery: Fix missing wrapper from last commit. 2017-06-12 07:43:04 -04:00
Steve Howell 8da391b51e zjquery: Fix chaining semantics.
We now make it so that $('foo').addClass(whatever) and similar
functions properly return the wrapper object for chaining
purposes.  We may eventually want to change the wrapper object
to automatically dispatch to the first child object, but this
should work for now.
2017-06-12 07:28:23 -04:00
Steve Howell 0b0c57bbe0 zjquery: Throw Error() object to get tracebacks.
If you throw a raw string in node, you don't get a traceback.
2017-05-31 09:10:43 -07:00
Steve Howell 689605dd2e Introduce make_zjquery(). 2017-05-24 17:41:41 -07:00
Steve Howell 46e72289d1 Add features to zjquery. 2017-05-24 17:41:41 -07:00
Steve Howell 4a062d47a6 Add more features to zjquery. 2017-05-24 13:08:54 -07:00
Steve Howell 1cb58d72b2 zjquery: Add focus/blur methods. 2017-05-23 18:52:25 -07:00
Steve Howell cd08bbe7d8 zjquery: Add array-like functionality to elements.
(We simulate the behavior that a jquery object looks like an
array, but also has methods that can be called as if it were a
scalar.)
2017-05-23 18:52:25 -07:00
Steve Howell 4c520780a1 zjquery: Support $(func) flavor of $() calls. 2017-05-23 18:52:25 -07:00
Joshua Pan f3369b266a node_tests: Extract and create fake_jquery as zjquery.
This allows us to use fake_jquery (originally only in
compose_actions.js) in all our node tests.
2017-05-23 10:27:07 -07:00
adnrs96 a91012bd70 Move thirdparty-fonts.css from static/styles to static/third. 2017-03-21 13:40:05 -07:00
Steve Howell ef3033c79e node tests: Make with_overrides() more granular.
The with_overrides() function no longer works at the module
level, so you can temporarily override one function in a module
without breaking more permanent monkey patches.

This makes us slightly more vulnerable to unintentional test
leakages, but it solves the problem where you often need lots
of temporary overrides for writer functions but you want to
keep a more permanent override for some sort of reader function.
2017-03-13 15:09:53 -07:00
Steve Howell a98999ce27 node tests: Extract with_overrides() helper.
The function with_overrides() uses the logic from the old
run() function in dispatch.js to allow you to call a test
function and override parts of the global namespace only
for the duration of when test_function runs.
2017-03-13 15:09:53 -07:00