Started working on getting the time logged today.

This commit is contained in:
Mario Basic
2015-06-14 00:31:22 +02:00
parent a43037fe78
commit 229f514819
12 changed files with 83 additions and 48 deletions

View File

@@ -15,6 +15,8 @@ var config = {
currentUserApiUrl: 'https://wakatime.com/api/v1/users/current', currentUserApiUrl: 'https://wakatime.com/api/v1/users/current',
// The url to logout the user from wakatime // The url to logout the user from wakatime
logoutUserUrl: 'https://wakatime.com/logout', logoutUserUrl: 'https://wakatime.com/logout',
// Gets stats from the WakaTime API
summariesApiUrl: 'https://wakatime.com/api/v1/users/current/summaries',
// Different colors for different states of the extension // Different colors for different states of the extension
colors: { colors: {
allGood: '', allGood: '',

View File

@@ -0,0 +1,13 @@
function getTodaysDateInFormat()
{
var today = new Date();
var month = today.getMonth() + 1;
var date = today.getDate();
if(month < 10) month = '0' + month;
if(date < 10) date = '0' + date;
return today.getFullYear() + '-' + month + '-' + date;
}
export default getTodaysDateInFormat;

View File

@@ -15,21 +15,21 @@
}, },
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"babel-jest": "^5.2.0", "babel-jest": "^5.3.0",
"chai": "^3.0.0",
"gulp": "^3.8.8", "gulp": "^3.8.8",
"jest-cli": "^0.4.10", "jest-cli": "^0.4.12",
"babel": "^5.5.6",
"laravel-elixir": "*", "laravel-elixir": "*",
"react-tools": "^0.13.3",
"mocha": "^2.2.5", "mocha": "^2.2.5",
"mocha-sinon": "^1.1.4", "mocha-sinon": "^1.1.4",
"mocha-traceur": "^2.1.0", "mocha-traceur": "^2.1.0",
"sinon": "^1.14.1" "sinon": "^1.14.1",
"babel": "^5.5.6",
"chai": "^3.0.0"
}, },
"dependencies": { "dependencies": {
"bootstrap": "^3.3.4", "bootstrap": "^3.3.4",
"jquery": "^2.1.3", "jquery": "^2.1.3",
"react": "^0.13.3", "react": "^0.13.3"
"react-tools": "^0.13.3"
} }
} }

View File

@@ -530,6 +530,8 @@ var config = {
currentUserApiUrl: 'https://wakatime.com/api/v1/users/current', currentUserApiUrl: 'https://wakatime.com/api/v1/users/current',
// The url to logout the user from wakatime // The url to logout the user from wakatime
logoutUserUrl: 'https://wakatime.com/logout', logoutUserUrl: 'https://wakatime.com/logout',
// Gets stats from the WakaTime API
summariesApiUrl: 'https://wakatime.com/api/v1/users/current/summaries',
// Different colors for different states of the extension // Different colors for different states of the extension
colors: { colors: {
allGood: '', allGood: '',

View File

@@ -119,6 +119,8 @@ var config = {
currentUserApiUrl: 'https://wakatime.com/api/v1/users/current', currentUserApiUrl: 'https://wakatime.com/api/v1/users/current',
// The url to logout the user from wakatime // The url to logout the user from wakatime
logoutUserUrl: 'https://wakatime.com/logout', logoutUserUrl: 'https://wakatime.com/logout',
// Gets stats from the WakaTime API
summariesApiUrl: 'https://wakatime.com/api/v1/users/current/summaries',
// Different colors for different states of the extension // Different colors for different states of the extension
colors: { colors: {
allGood: '', allGood: '',

View File

@@ -89,6 +89,8 @@ var config = {
currentUserApiUrl: 'https://wakatime.com/api/v1/users/current', currentUserApiUrl: 'https://wakatime.com/api/v1/users/current',
// The url to logout the user from wakatime // The url to logout the user from wakatime
logoutUserUrl: 'https://wakatime.com/logout', logoutUserUrl: 'https://wakatime.com/logout',
// Gets stats from the WakaTime API
summariesApiUrl: 'https://wakatime.com/api/v1/users/current/summaries',
// Different colors for different states of the extension // Different colors for different states of the extension
colors: { colors: {
allGood: '', allGood: '',

View File

@@ -1,17 +1,17 @@
jest.dontMock('../../assets/js/components/MainList.react.js'); jest.dontMock('../../assets/js/components/MainList.react.js');
describe('MainList', function() { describe('MainList', function() {
var React, MainList, TestUtils, Component; var React, MainList, TestUtils, Component;
beforeEach(function() { beforeEach(function() {
// Setup our tools // Setup our tools
React = require('react/addons'); React = require('react/addons');
MainList = require('../../assets/js/components/MainList.react.js'); MainList = require('../../assets/js/components/MainList.react.js');
TestUtils = React.addons.TestUtils; TestUtils = React.addons.TestUtils;
// Create the React component here using TestUtils and store into Component // Create the React component here using TestUtils and store into Component
}); });
it('should work', function() { it('should work', function() {
expect(2 + 2).toEqual(4); expect(2 + 2).toEqual(4);
}); });
}); });

View File

@@ -1,17 +1,17 @@
jest.dontMock('../../assets/js/components/Navbar.react.js'); jest.dontMock('../../assets/js/components/Navbar.react.js');
describe('Navbar', function() { describe('Navbar', function() {
var React, Navbar, TestUtils, Component; var React, Navbar, TestUtils, Component;
beforeEach(function() { beforeEach(function() {
// Setup our tools // Setup our tools
React = require('react/addons'); React = require('react/addons');
Navbar = require('../../assets/js/components/Navbar.react.js'); Navbar = require('../../assets/js/components/Navbar.react.js');
TestUtils = React.addons.TestUtils; TestUtils = React.addons.TestUtils;
// Create the React component here using TestUtils and store into Component // Create the React component here using TestUtils and store into Component
}); });
it('should work', function() { it('should work', function() {
expect(2 + 2).toEqual(4); expect(2 + 2).toEqual(4);
}); });
}); });

View File

@@ -1,17 +1,17 @@
jest.dontMock('../../assets/js/components/Wakatime.react.js'); jest.dontMock('../../assets/js/components/Wakatime.react.js');
describe('Wakatime', function() { describe('Wakatime', function() {
var React, Wakatime, TestUtils, Component; var React, Wakatime, TestUtils, Component;
beforeEach(function() { beforeEach(function() {
// Setup our tools // Setup our tools
React = require('react/addons'); React = require('react/addons');
Wakatime = require('../../assets/js/components/Wakatime.react.js'); Wakatime = require('../../assets/js/components/Wakatime.react.js');
TestUtils = React.addons.TestUtils; TestUtils = React.addons.TestUtils;
// Create the React component here using TestUtils and store into Component // Create the React component here using TestUtils and store into Component
}); });
it('should work', function() { it('should work', function() {
expect(2 + 2).toEqual(4); expect(2 + 2).toEqual(4);
}); });
}); });

View File

@@ -4,7 +4,7 @@ var expect = chai.expect;
import changeExtensionIcon from '../../assets/js/helpers/changeExtensionIcon'; import changeExtensionIcon from '../../assets/js/helpers/changeExtensionIcon';
describe('changeExtensionIcon', function() { describe('changeExtensionIcon', function() {
it('should be a function', function() { it('should be a function', function() {
expect(changeExtensionIcon).to.be.a('function'); expect(changeExtensionIcon).to.be.a('function');
}); });
}); });

View File

@@ -4,7 +4,7 @@ var expect = chai.expect;
import currentTimestamp from '../../assets/js/helpers/currentTimestamp'; import currentTimestamp from '../../assets/js/helpers/currentTimestamp';
describe('currentTimestamp', function() { describe('currentTimestamp', function() {
it('should be a function', function() { it('should be a function', function() {
expect(currentTimestamp).to.be.a('function'); expect(currentTimestamp).to.be.a('function');
}); });
}); });

View File

@@ -0,0 +1,14 @@
var chai = require('chai');
var expect = chai.expect;
import getTodaysDateInFormat from '../../assets/js/helpers/getTodaysDateInFormat';
describe('getTodaysDateInFormat', function() {
it('should be a function', function() {
expect(getTodaysDateInFormat).to.be.a('function');
});
it('should return todays date in format YYYY-MM-DD', function() {
expect(getTodaysDateInFormat()).to.be('2015-06-14');
});
});