Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card class testing #8

Merged
merged 13 commits into from
Aug 11, 2017
Merged

Card class testing #8

merged 13 commits into from
Aug 11, 2017

Conversation

laurengastineau
Copy link
Contributor

Updated:

  • Card class now builds its contents, including:
    • Buttons (save, expand, close)
    • Namebox, which contains a card's name based on the card's id.
    • Header, which contains a card's namebox and buttons.
    • Card body, which contains a card's header.
  • TextEditor and CodeEditor classes now build their contents, including:
    • Three card faces; the first two card faces containing a textarea and the third card face containing a div.
  • SketchPad class now build their contents, including:
    • Buttons (drawing, eraser)
    • Three card faces; all three containing a div.
    • Raphael sketchpad is appended to card faces.
  • Canvas class now has remove card functionality.
  • Card Tests checks:
    • Cards contain content listed above.
    • Metadata is built.
    • Metadata will update.
    • TextEditor, SketchPad, and CodeEditor contain contents listed above.
  • Canvas Tests now checks that the correct number of cards is accounted for by the canvas when cards are added and/or removed.

@nelsonni
Copy link
Member

nelsonni commented Aug 8, 2017

@laurengastineau Travis CI is currently showing failed builds for both Node.js versions latest and 7 on the linux platform. Although they haven't finished yet, I suspect that the osx platform tests will also fail. The error that I see in the builds is:

1) canvas interactions "before all" hook:
     Error: Cannot find module 'jsdom-global'
      at require (internal/module.js:11:18)
      at Context.<anonymous> (test/canvas-test.js:18:18)

  2) cards interactions "before all" hook:
     Error: Cannot find module 'jsdom-global'
      at require (internal/module.js:11:18)
      at Context.<anonymous> (test/card-test.js:23:18)

I suspect that running these same tests on your own machine did not result in any failures because you have installed the jsdom-global (and that packages required dependency of jsdom) as global packages.

When introducing new packages to the project, you need to also update the package.json file so that Travis CI (and anyone else pulling the source and attempting to run the project) can execute npm install and have all necessary packages installed. Please be aware of the differences between the dependencies and devDependencies sections in package.json (npmjs:package.json#dependencies) when making updates to that file.

Also, #6 introduces those same packages to the project. Look at the package.json in that branch or review and accept that PR to pull those changes into master branch and update your PR.

@nelsonni nelsonni self-requested a review August 8, 2017 17:42
@nelsonni nelsonni added feature Feature requests or improvements duplicate labels Aug 8, 2017
@nelsonni nelsonni added this to the v0.6.0 milestone Aug 8, 2017
@nelsonni
Copy link
Member

nelsonni commented Aug 8, 2017

The latest Travis CI build (Build #29) is failing because of a broken merge between master and card-class-testing branches. Specifically, the API structure in the app/Card.js#constructor() has heavily changed and has not been properly integrated.

There is code in app/Card.js that is hanging outside of a code block and causing runtime errors (which can be seen when running npm start from the card-class-testing branch, which is currently at commit 93bd66a):

constructor({
      id = Error.throwIfMissing('id'),
      context = Error.throwIfMissing('context'),
      modal = true
    }) {
    this.id = id;
    this.createdBy = require('username').sync();
    this.createdTimestamp = new Date();
    this.lastInteraction = new Date();

    this.card = document.createElement('div');
    $(this.card).attr({
      id: this.id,
      class: 'card',
    });

    this.header = document.createElement('div');
    $(this.header).attr('class', 'card-header');

    this.title = document.createElement('span');
    $(this.title).html("My Card");

    this.header.appendChild(this.title);
    this.card.appendChild(this.header);
    context.appendChild(this.card);
    if (modal) this.toggleDraggable();
  }


    //for metadata
    this.createdTimestamp = new Date().toString();
    this.lastInteraction = new Date();
    // npm module: username, url: https://www.npmjs.com/package/username
    this.createdBy = require('username').sync();

    this.cardBuilder(type);
    this.updateMetadata();
  }

Also, the Card#cardBuilder() function has been deprecated in favor of inline declarations of HTML DOM elements from within the Card#constructor() function.

…ed. Tests that will not currently passed are commented out. Card, canvas, and extended card classes are simplified.
Copy link
Member

@nelsonni nelsonni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the two concerns outlined for test/card-test.js on lines 20 and 99-103. I will approve this PR when a fix has been added.

path: electron,
this.jsdom = require('jsdom-global')()
global.$ = global.jQuery = require('jquery');
app = new Application({ path: electron,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For line 20, there isn't really a good reason to shorten the path: field onto the same line as the new Application declaration; this change adds clutter.

"\n\t(lastInteraction should update after Card#updateMetadata()" +
" method is evoked)";
"\n\t(lastInteraction should update after Card#updateMetadata()" +
" method is evoked)";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For lines 102-103, it is unclear why these lines are being shortened up to the same vertical alignment as line 101, which represents the starting line for the run-on content that is on lines 102-103. Especially in light of the allowance for the original style on lines 99-100 remaining the same. This change creates a discontinuity in styles.

@nelsonni nelsonni merged commit c3a86e9 into master Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate feature Feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants