Skip to content

Commit

Permalink
Removed Deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
imsingh authored and imsingh committed May 27, 2015
1 parent c36e999 commit 54b45f7
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 13 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 <Your name here>
Copyright (c) 2015 <Your name here>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Feel Free to let me know about issues via :

* [Issues](https://github.com/imsingh/ionic-atom-plugin/issues)

## Installation

```
apm install ionic-framework-snippets
```

## What's Included - Content

### AngularJS Directive based Ionic Snippets
Expand Down
11 changes: 11 additions & 0 deletions keymaps/ionic-framework-snippets.cson
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'
22 changes: 22 additions & 0 deletions lib/ionic-framework-snippets-view.coffee
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
33 changes: 33 additions & 0 deletions lib/ionic-framework-snippets.coffee
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()
22 changes: 22 additions & 0 deletions menus/ionic-framework-snippets.cson
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'
}
]
]
}
]
15 changes: 9 additions & 6 deletions package.json
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": {
}
}
62 changes: 62 additions & 0 deletions spec/ionic-framework-snippets-spec.coffee
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()
5 changes: 5 additions & 0 deletions spec/ionic-framework-snippets-view-spec.coffee
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"
8 changes: 8 additions & 0 deletions styles/ionic-framework-snippets.less
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 {
}

0 comments on commit 54b45f7

Please sign in to comment.