-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
imsingh
authored and
imsingh
committed
May 27, 2015
1 parent
c36e999
commit 54b45f7
Showing
11 changed files
with
173 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Keybindings require three things to be fully defined: A selector that is | ||
# matched against the focused element, the keystroke and the command to | ||
# execute. | ||
# | ||
# Below is a basic keybinding which registers on all platforms by applying to | ||
# the root workspace element. | ||
|
||
# For more detailed documentation see | ||
# https://atom.io/docs/latest/behind-atom-keymaps-in-depth | ||
'atom-workspace': | ||
'ctrl-alt-o': 'ionic-framework-snippets:toggle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = | ||
class IonicFrameworkSnippetsView | ||
constructor: (serializedState) -> | ||
# Create root element | ||
@element = document.createElement('div') | ||
@element.classList.add('ionic-framework-snippets') | ||
|
||
# Create message element | ||
message = document.createElement('div') | ||
message.textContent = "The IonicFrameworkSnippets package is Alive! It's ALIVE!" | ||
message.classList.add('message') | ||
@element.appendChild(message) | ||
|
||
# Returns an object that can be retrieved when package is activated | ||
serialize: -> | ||
|
||
# Tear down any state and detach | ||
destroy: -> | ||
@element.remove() | ||
|
||
getElement: -> | ||
@element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
IonicFrameworkSnippetsView = require './ionic-framework-snippets-view' | ||
{CompositeDisposable} = require 'atom' | ||
|
||
module.exports = IonicFrameworkSnippets = | ||
ionicFrameworkSnippetsView: null | ||
modalPanel: null | ||
subscriptions: null | ||
|
||
activate: (state) -> | ||
@ionicFrameworkSnippetsView = new IonicFrameworkSnippetsView(state.ionicFrameworkSnippetsViewState) | ||
@modalPanel = atom.workspace.addModalPanel(item: @ionicFrameworkSnippetsView.getElement(), visible: false) | ||
|
||
# Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable | ||
@subscriptions = new CompositeDisposable | ||
|
||
# Register command that toggles this view | ||
@subscriptions.add atom.commands.add 'atom-workspace', 'ionic-framework-snippets:toggle': => @toggle() | ||
|
||
deactivate: -> | ||
@modalPanel.destroy() | ||
@subscriptions.dispose() | ||
@ionicFrameworkSnippetsView.destroy() | ||
|
||
serialize: -> | ||
ionicFrameworkSnippetsViewState: @ionicFrameworkSnippetsView.serialize() | ||
|
||
toggle: -> | ||
console.log 'IonicFrameworkSnippets was toggled!' | ||
|
||
if @modalPanel.isVisible() | ||
@modalPanel.hide() | ||
else | ||
@modalPanel.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details | ||
'context-menu': | ||
'atom-text-editor': [ | ||
{ | ||
'label': 'Toggle ionic-framework-snippets' | ||
'command': 'ionic-framework-snippets:toggle' | ||
} | ||
] | ||
'menu': [ | ||
{ | ||
'label': 'Packages' | ||
'submenu': [ | ||
'label': 'ionic-framework-snippets' | ||
'submenu': [ | ||
{ | ||
'label': 'Toggle' | ||
'command': 'ionic-framework-snippets:toggle' | ||
} | ||
] | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
{ | ||
"name": "ionic-framework-snippets", | ||
"main": "./lib/ionic-framework-snippets", | ||
"version": "1.1.0", | ||
"description": "A Snippet Package for Ionic Frameowork with Tons of Useful Snippets.", | ||
"activationEvents": [ | ||
"ionic-snippets-plugin:toggle" | ||
"version": "1.1.1", | ||
"description": "A Snippet Plugin for Ionic Framework", | ||
"keywords": [ | ||
], | ||
"activationCommands": { | ||
"atom-workspace": "ionic-framework-snippets:toggle" | ||
}, | ||
"repository": "https://github.com/imsingh/ionic-atom-plugin", | ||
"license": "MIT", | ||
"engines": { | ||
"atom": ">0.50.0" | ||
"atom": ">=0.174.0 <2.0.0" | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
IonicFrameworkSnippets = require '../lib/ionic-framework-snippets' | ||
|
||
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs. | ||
# | ||
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit` | ||
# or `fdescribe`). Remove the `f` to unfocus the block. | ||
|
||
describe "IonicFrameworkSnippets", -> | ||
[workspaceElement, activationPromise] = [] | ||
|
||
beforeEach -> | ||
workspaceElement = atom.views.getView(atom.workspace) | ||
activationPromise = atom.packages.activatePackage('ionic-framework-snippets') | ||
|
||
describe "when the ionic-framework-snippets:toggle event is triggered", -> | ||
it "hides and shows the modal panel", -> | ||
# Before the activation event the view is not on the DOM, and no panel | ||
# has been created | ||
expect(workspaceElement.querySelector('.ionic-framework-snippets')).not.toExist() | ||
|
||
# This is an activation event, triggering it will cause the package to be | ||
# activated. | ||
atom.commands.dispatch workspaceElement, 'ionic-framework-snippets:toggle' | ||
|
||
waitsForPromise -> | ||
activationPromise | ||
|
||
runs -> | ||
expect(workspaceElement.querySelector('.ionic-framework-snippets')).toExist() | ||
|
||
ionicFrameworkSnippetsElement = workspaceElement.querySelector('.ionic-framework-snippets') | ||
expect(ionicFrameworkSnippetsElement).toExist() | ||
|
||
ionicFrameworkSnippetsPanel = atom.workspace.panelForItem(ionicFrameworkSnippetsElement) | ||
expect(ionicFrameworkSnippetsPanel.isVisible()).toBe true | ||
atom.commands.dispatch workspaceElement, 'ionic-framework-snippets:toggle' | ||
expect(ionicFrameworkSnippetsPanel.isVisible()).toBe false | ||
|
||
it "hides and shows the view", -> | ||
# This test shows you an integration test testing at the view level. | ||
|
||
# Attaching the workspaceElement to the DOM is required to allow the | ||
# `toBeVisible()` matchers to work. Anything testing visibility or focus | ||
# requires that the workspaceElement is on the DOM. Tests that attach the | ||
# workspaceElement to the DOM are generally slower than those off DOM. | ||
jasmine.attachToDOM(workspaceElement) | ||
|
||
expect(workspaceElement.querySelector('.ionic-framework-snippets')).not.toExist() | ||
|
||
# This is an activation event, triggering it causes the package to be | ||
# activated. | ||
atom.commands.dispatch workspaceElement, 'ionic-framework-snippets:toggle' | ||
|
||
waitsForPromise -> | ||
activationPromise | ||
|
||
runs -> | ||
# Now we can test for view visibility | ||
ionicFrameworkSnippetsElement = workspaceElement.querySelector('.ionic-framework-snippets') | ||
expect(ionicFrameworkSnippetsElement).toBeVisible() | ||
atom.commands.dispatch workspaceElement, 'ionic-framework-snippets:toggle' | ||
expect(ionicFrameworkSnippetsElement).not.toBeVisible() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
IonicFrameworkSnippetsView = require '../lib/ionic-framework-snippets-view' | ||
|
||
describe "IonicFrameworkSnippetsView", -> | ||
it "has one valid test", -> | ||
expect("life").toBe "easy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// The ui-variables file is provided by base themes provided by Atom. | ||
// | ||
// See https://github.com/atom/atom-dark-ui/blob/master/styles/ui-variables.less | ||
// for a full listing of what's available. | ||
@import "ui-variables"; | ||
|
||
.ionic-framework-snippets { | ||
} |