• 
      

    Enable dynamic options for models, and add unit tests.

    Review Request #12911 — Created March 23, 2023 and submitted

    Information

    Spina
    master

    Reviewers

    This updates BaseModel to accept functions in place of values for some
    of the new static attributes, and to add missing attributes for
    customization.

    defaults can now be a hash or a function. In function form, it can
    access this, since it's being copied to and run off of the prototype
    at class construction time.

    urlRoot has been added, which was missing before. This can be a string
    or a function.

    Declarations for instance-level defaults and idAttribute were
    removed, as they weren't actually needed.

    A new ModelAttributes type has been added and exported, allowing for
    easier reference without referencing Backbone.ObjectHash.

    Unit tests have been added to test all model construction behavior, with
    static attributes or functions.

    Unit tests pass.

    Summary ID
    Enable dynamic options for models, and add unit tests.
    This updates `BaseModel` to accept functions in place of values for some of the new static attributes, and to add missing attributes for customization. `defaults` can now be a hash or a function. In function form, it can access `this`, since it's being copied to and run off of the prototype at class construction time. `urlRoot` has been added, which was missing before. This can be a string or a function. Declarations for instance-level `defaults` and `idAttribute` were removed, as they weren't actually needed. Unit tests have been added to test all model construction behavior, with static attributes or functions.
    ae40e4728bb07326f50b8aeeea374608b48dc95c
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (7b76521)