Giter VIP home page Giter VIP logo

jermaine's People

Contributors

embeepea avatar frimmel avatar semmypurewal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jermaine's Issues

connect to a view system

Figure out a way to have Jermaine objects renderable via a view system like Handlebar or Mustache. The API should be really simple, preferably something like this:

Person.looksLike("template.js");

where template.js is a template file in a separate (views?) directory. The simpler the API, the better.

Yet another bug/failing test

This test seems to fail:

    it("another bug?", function () {
        var Person,
    p, p1, p2, p3, p4;
        Person = new Model(function () {
            this.hasA("name").which.isA("string");
            this.hasMany("friends").eachOfWhich.validateWith(function (friend) {
                return friend instanceof Person;
            });
        });

        expect(function () {
            p = new Person("Semmy");
    }).not.toThrow();
    });

Automated Documentation

Use JSDoc or something similar to generate HTML documentation for Jermaine's public API, particularly the Model function and Model objects.

add javascript-style constructors

Allow an option for the user to use JavaScript style constructors for model instances, e.g.

var p = new Person({"name":"Semmy", "id":1001});

attributes are emitting events to all instances of objects

This test is failing.

var p1, p2;
p1 = new Person();
p2 = new Person();
expect(spy1.callCount).toBe(0);
expect(spy2.callCount).toBe(0);

p1.on("change", spy1);
p2.on("change", spy2);

p1.name("semmy");
expect(spy1.callCount).toBe(1);
expect(spy2.callCount).toBe(0);

removeAt

add attr_list removeAt() met hod

Failing tests in IE8

Versions of IE prior to 9 do not have an implementation of Array.indexOf().

Issue arises in Validator.js -> isA

Documentation

The documentation needs to be updated. Also, inline documentation needs to be added to all core objects.

pop not working in attr_list

This jasmine test is failing

describe("pop method", function () {
    it("should return the object which was popped", function () {
        var lastObj = "mark",
            poppedObj;
        obj.friends().add("john");
        obj.friends().add("semmy");
        obj.friends().add(lastObj);
        poppedObj = obj.friends().pop();
        expect(poppedObj).toEqual(lastObj);
    });

    it("should decrease the size of the attr_list", function () {
        var size;
        obj.friends().add("john");
        obj.friends().add("semmy");
        obj.friends().add("mark");
        size = obj.friends().size();
        obj.friends().pop();
        expect(obj.friends().size()).toEqual(size-1);
    });
});

Error/Exception type hierarchy

We need a new solution for handling errors. This is due to error messages currently being specified in two places: the src file that throws the errors and spec files which checks for the error message. This is an inefficient and bug-prone approach.

A better solution might be to create a type-hierarchy of Errors/Exceptions, and check for the types in the spec file, rather than specific messages.

coding consistency in model.js

check for indentation and spaces between for and if, also check that <=> this in constructor and create function to make sure they are being used.

infinite events emitted on circular references.

        var p1, p2;
        p1 = new Person();
        p2 = new Person();

        expect(spy1.callCount).toBe(0)
        expect(spy2.callCount).toBe(0)

        p1.on("change", spy1);

        p2.on("change", spy2);

        p1.friend(p2);

        expect(spy1.callCount).toBe(1);
        expect(spy2.callCount).toBe(0);

        //causes infinite loop                                                                                                                                                                          
        p2.friend(p1);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.